File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Regarding Jtable row Deletion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Regarding Jtable row Deletion" Watch "Regarding Jtable row Deletion" New topic
Author

Regarding Jtable row Deletion

chandu gopi
Greenhorn

Joined: Dec 23, 2009
Posts: 4
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

Joined: Jul 26, 2007
Posts: 10451
    
    8

What have you got so far and where are you stuck?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
chandu gopi
Greenhorn

Joined: Dec 23, 2009
Posts: 4
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

Joined: Jun 09, 2003
Posts: 4632
reload the model, same as when you loaded the JTable first time round
 
wood burning stoves
 
subject: Regarding Jtable row Deletion