• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable selected Data not updated  RSS feed

 
Suraj Panda
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have set data to jTable using DataModel, & want to perform CRUD operations.
But the problem is that IF click first & then sort the table data using rowsorter, then the previous selected value is retained.

Help me to update the currentselection value after sorting.


Reply appreciated


Thanks,
Suraj
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not really sure what the stated problem is, but a couple of methods of the rowSorter might suit

convertRowIndexToModel
convertRowIndexToView
 
Suraj Panda
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestion. Have a look at my issue & help me...

After displaying data in JTable, Suppose i click on a row & then sort the row by clicking on the JTable header. After sorting, I click on update/delete button to edit the current selected user data.
But the data is coming at the row number while I clicked instead of actual row selected.

Ex:

Suppose I click on row num: 3 to update & then sort the row data. After sorting row num :3 comes to position : 6 . But while clicking on update button it takes the data of current row which is in row num: 3 instead of actual row num: 6.



Please suggest.

Thanks
Suraj
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what happened when you looked into the suggested methods?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!