Visual Java/SWING CompoFail to dynamically change Column Width/Order for ELTable(Read 13780 times)
I try to dynamically update the column width and order just after initializing the ELTable and setting its model as below:

[div class=\'codetop\']CODE[/div][div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']

ELTableColumnModel cm = ((ELTableColumnModel)getTblOrderData().getColumnModel());

System.out.println(getTblOrderData().getColumnModel().getColumn(0).getWidth());

cm.getColumn(0).setWidth(200);

System.out.println(getTblOrderData().getColumnModel().getColumn(0).getWidth());

[/div]

Result:
75 (default col width)
200 (my desired col width)

However, no width change in the screen and the width auto-change back to 75 next time.

At the same time I use the following code to change the Col order
[div class=\'codetop\']CODE[/div][div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']((ELTableColumn) getColumn("Col1")).setModelIndex(5);[/div]

Again.  No change at all.


Did I miss something?
« Last Edit: November 21, 2007, 04:06:48 PM by Maria »



Fail to dynamically change Column Width/Order for ELTable Reply #1 on: July 19, 2007, 05:15:33 PM
Thank you for the question. I will reply you within several business days.



Fail to dynamically change Column Width/Order for ELTable Reply #2 on: July 20, 2007, 05:16:57 AM
Quote from: Maria
Thank you for the question. I will reply you within several business days.


Thanks a lot, Maria.  Looking forward to hearing you back.



Fail to dynamically change Column Width/Order for ELTable Reply #3 on: July 23, 2007, 09:30:51 AM
Have you already set the AutoResizeMode? I would like to advise you to  look into the following class method in your API:

JTable.setAutoResizeMode()



Fail to dynamically change Column Width/Order for ELTable Reply #4 on: July 23, 2007, 11:22:22 AM
Quote from: Maria
Have you already set the AutoResizeMode? I would like to advise you to  look into the following class method in your API:

JTable.setAutoResizeMode()


setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

The auto-resizing works fine (actually I don't want it resize for me)

Any hint?



Fail to dynamically change Column Width/Order for ELTable Reply #5 on: July 23, 2007, 04:36:22 PM
Please, try to use the following method:

setPreferredWidth()



Fail to dynamically change Column Width/Order for ELTable Reply #6 on: July 24, 2007, 05:26:16 AM
Quote from: Maria
Please, try to use the following method:

setPreferredWidth()


It works!  Thanks a lot!



 

Sitemap 1 2 3 4 5