Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6638883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:29:23+00:00 2026-05-25T23:29:23+00:00

I am creating a program that filters the contents of a JTable using two

  • 0

I am creating a program that filters the contents of a JTable using two columns. I have used a RowSorter and everything works fine – at least according to what I can see (the view).

Each row on the table can be double clicked to open a dialog. This dialog allows you to edit information on the table. However, the information on the dialog is still of that of the original view (before filtering was used).

Example:

Before filtering the first row on the table is row a.
After filtering the first row on the table is row b.

However, when I double click to open the dialog on the first row (after filtering, which should now be row b, the dialog for row a opens.)
[Hope I’ve explained this well enough]

I think my problem is that the model isn’t being updated after the filters have taken place. I’ve tried:

        for(int i = 0; i < table.getRowCount(); i++){
        table.convertRowIndexToView(i);
    }

and

for(int i = 0; i < table.getRowCount(); i++){
        table.convertRowIndexToModel(i);
    }

I am also getting a similar problem when I sort the table using the column headers.

How do I fix this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:29:24+00:00Added an answer on May 25, 2026 at 11:29 pm

    I think my problem is that the model isn’t being updated after the filters have taken place

    The model is never updated.

    Only the view is updated to show the data from the model in a sorted/filtered order.

    Each row on the table can be double clicked to open a dialog.

    So I assume you copy the data for one row to the dialog so it can be edited and then added back to the original model.

    Therefore you need to use the convertRowIndexToModel(...) to get the model row number so you can access the model data to be displayed on the edit dialog. You would only do this for the row to be edited, not the entire table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a program that will be installed using the .net installer project.
I have been tasked with creating a program that will generate an amortization schedule.
I creating a program which send newsletter with a background image. It works fine
I am creating a program that encrypts/hashs messages I have a list that contains
I'm creating a program that gets data from a server using AJAX/JSON and then
Im creating a program that is supposed have the user enter a student name
I'm a java beginner, & I'm creating a program that draws lines using the
I'm planning on creating a program that will have a login form and then
I am creating a program that needs to store the user's data in encrypted
I am creating a program that displays a popup at certain times (just like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.