In my JTable
, among other columns, I have a "Serial No" column which simply numbers the records in the table. I want this column to be fixed while I sort the rows by clicking on the JTable
column headers. The sorting is happening alright, but the "Serial No" is getting mixed up in the process. Is there any way I could keep the "Serial No." column fixed while I sort the rows?
Thanks for your help on this.
Example:
SlNo Name
1 John
2 Peter
3 Alek
After sorting this by (clicking on 'Name' column), I get this:
SlNo Name
3 Alek
1 John
2 Peter
However, I would like the results as:
SlNo Name
1 Alek
2 John
3 Peter