• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable selection problem

 
Thomas Suer
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because I have posted this message again without any response I post it again...
I have a problem regarding the selection of table rows. Let's say a table is displaying 10 rows. The table also has a sorting algorithm that gets triggered when the user clicks on a table's column header. For instance the 2nd and 3rd row are selected. Then when the sorting order gets changed (by clicking on a table's column header) the selected rows stay the same, that means the 2nd and 3rd row are still selected instead of the previous selected elements. Does anyone has an idea to solve this problem?
Thanks in advance
Tom
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
when a sorting event occurs the selection should be updated. so you need a class that implements your SortingListener, e.g., with the method sortingUpdated(SortingEvent e){ updateSelection(); }. I myself would just remove the selection. hm, does the user really expect the selection to resist to sorting?
chantal
 
Thomas Suer
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chantal
and thanks for your response!
I usually don't like to compare to Microsoft Windows programs, but my software shall be and act 'windowslike'. So if you think of the Explorer then you can make a selection in the right localized table and change the table's sorting order by clicking the appropriate table's header. As a result the selected items are still selected.
Thanks
Tom
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!