"matt dash" wrote in message <email@example.com>... > "Alexander Mering" wrote in message <firstname.lastname@example.org>... > > Dear group,
--- snip ---
> > I hope my questions are quite clear and that anyone out there would find the time to help me. I really digged the web but did not find anything to make the SortableTable work the way I need it. > > > > I apreciate any hints and hope for some answers. > > > > Sincerely, > > > > Alexander
thank you very much for your reply. It really helped me.
> If you're not using the sorting, is there a reason you're using the jide sortable table instead of a regular jtable? That shouldnt be terribly important, but it's something to think about.
Your quite right. When deciding for the SortableTable, I had (wrongly) in mind to stay as close to the new uitable in Matlab. But using a JTable is not what I want since for instance I want the user to be allowed to set column width also within the table itself. So, based on your comment, I changed to the JideTable.
> 1) I find it easiest to just make a new tablemodel that contains the new data you need. So just make a new cell array in matlab that contains the empty row of zeros at the end. Then just call setModel on your table to update it.
That is right, but to my current understanding of java (in Matlab) this leads to the overwriting of my Renderer settings (I see it and somewhere read about it). So after settings the TableModel, all renderer and column width settings are gone, right? At least this is what I experience.
For this reason I turned off "AutoCreateColumnsfromModel" right away. As soon I turn it on, my layout is gone.
But with your hint I managed to add columns to the table by first redefining the Tablemodel and then apply jhandle.addColumn.
> 2) I find it easiest to just set the column witdh to 0 for columns you don't want to see. Unless you have a compelling reason to get rid of them entirely... then i would recreate the table model as in 1.
Since my table will be used for user input and post-processing, I always need proper labelling of the header. This would not work out, right? Furthermore if the user decides a column to be deleted, I really do not need it anymore. So I will completely remove it.
So far, I did not manage it to recreate the table in the way you described in 1). During trying, I realized another thing. In 1) I now create a new tablemodel using javax.swing.table.DefaultTableModel together with the cell array for the data. But initially, the JideTable uses as tablemodel javax.swing.JTable$1. Maybe this explains my problems?
When I try to delete the column, neither the way a) first remove column, then tablemodel nor b) tablemodel first, then remove column work in a proper way.
In a) the column is nicely removed and everything looks like it should but the model still got the old information. When I reset the tablemodel, the whole table becomes white and uneditable. No information could be seen.
In b) the table looks as bad as in b).
so for some reason, it just does not work out. Do you (Matt) or anyone else have another hint on proper deletion of a column in JideTable?
> 3) The callback is named TableChangedCallback, not DataChangedCallback. It is a property of the table model, not the table.