Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Jtable row Deletion

 
chandu gopi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm new to JTable. I have two buttons "add Row", "Del Row" and I have some records displayed from db which contains an auto increment column. when ever "add row" is clicked a new record will be added to JTable with a auto increment column number displayed in sequential order.

My requirement is when ever a specific row in between is removed by clicking "del row" button. then the succeeding records auto increment column should be updated with removed column id and the sequence should be updated for the remaining columns. The same has to be updated in the database too.

please help me on this regard.

Thanks in advance,
Chandu
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you got so far and where are you stuck?
 
chandu gopi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mannesh,

when I delete the row from jTable the associated record in db is also deleted but in the front end in jTable I'm unable to update the "auto increment column".

Ex: 1,2,3,4... are the incremental column id. when i delete 3rd row then it is displaying as 1,2,4.... in jtable. But my requirement is the rows after the deleted row id should be incremented in sequence with the row id of the previous row of the deleted row which should be 1,2,3.....

Thanks in advance,

Regards,
Chandu.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
reload the model, same as when you loaded the JTable first time round
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic