Skip to main content

sharing model between treetable and jtable for freezing columns

6 replies [Last post]
navinkjha
Offline
Joined: 2004-12-28
Points: 0

I need to used JXTreeTable as table with columns frozen. Then I need to have a JTable on the right of it which does not have frozen columns. I see that the documentation of JXTreeTable says not to share models in any way. I need to populate the JTable on the right using the model of JXTreeTable. How do I accomplish this without sharing the model ?

-Navin

Message was edited by: navinkjha

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pallavialuri
Offline
Joined: 2012-05-28
Points: 0

Hi I have implemented a JTable for freezing columns using the model of JTreeTable. When the frozen columns are present i want to edit the first column in the JTreeTable. Please give some pointers regarding this.If the first column width of JTreeTable is the same or less than the first column width of the JTable on the right side then i am not able to edit the first column of JTreeTable. But if i increase the width of the first column of the JTreeTable more than the width of the first column of JTable, then i am able to edit the cell..The isCellEditable() method is hit in the second case but in the first case its not.

Please help me out in this.

Thanks and Regards,
Pallavi

kschaefe
Offline
Joined: 2006-06-08
Points: 0

A small, runnable test case is necessary.

Karl

kschaefe
Offline
Joined: 2006-06-08
Points: 0

You should be able to share the TableModel. Construct the JXTable as follows:
new JXTable(treeTable.getModel(), null, treeTable.getSelectionModel());

That will build a JXTable that is as linked as you'd want it to be. You'll need to modify the column models for the tree table and regaular table to display on the columns that you are interested in displaying.

Start there and let us know what problems you encounter. Good luck,

Karl

navinkjha
Offline
Joined: 2004-12-28
Points: 0

Thanks Karl,

Ok. I will go this route. Two questions.

1. How about using two treetables where the treetable on the right does not show any tree ?

2. does the sorting work properly in treetable ?

kschaefe
Offline
Joined: 2006-06-08
Points: 0

> 1. How about using two treetables where the
> treetable on the right does not show any tree ?
I wouldn't have both of them be tree tables. You want to "synchronize" on the table display, not the tree side. One tree table should be enough.

> 2. does the sorting work properly in treetable ?
Not currently. There's a bug/RFE for it. I hope to look into that somewhat, but realistically, it doesn't make sense to fix sorting/filtering for a schema that will go away when we move to a Java 6 baseline.

I may try to branch a Mustang-sorting-enabled JXTreeTable in my incubator. I'll keep everyone posted on that, as I make progress. Right now, my focus is on some JXLoginPanel bugs.

Karl

navinkjha
Offline
Joined: 2004-12-28
Points: 0

Karl,

I saw the warning about not using TableModel which is why is I thought of using another treetable since it is advertised that it's model can be shared. Since you said that TableModel can be shared I will try that.

Thanks
-Navin

Message was edited by: navinkjha