• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JTable selection problem

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Run away! Run away! Here, take this tiny ad with you:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic