PDA

View Full Version : Upgrade to GXT 2.0.1 - Grid Control no longer automatically redrawing



wmitchell
21 Jun 2010, 8:56 AM
In my UI the user could trigger an event which caused the following code to run.




columns.add(new ColumnConfig("MODELDATA_A", "ASDF", COLUMNWIDTH));
columns.add(new ColumnConfig("MODELDATA_B", "XYZ", COLUMNWIDTH));

grid.getColumnModel().setColumnHeader(0,grid.getColumnModel().getColumnHeader(0));

It now seems that the setColumnHeaderl line at the bottom is no longer causing the Grid control legend to redraw since I have upgraded gxt versions. I've tried all kinds of calls to repaint etc.. By the looks of it this "hack" that had been used in the application previous does not seem to work. Any ideas would be much appreciated.

W

sven
21 Jun 2010, 9:01 AM
I dont understand the last line. It is setting the same header as there was before? What do you want to do?

Also i tested it with the latest verion (GXT 2.1.3) and it worked without problems

wmitchell
22 Jun 2010, 1:29 AM
Sven,

So the column config wasn't populated in code I had an almost empty ColumnConfig except a checkbox.



columns = new ArrayList<ColumnConfig>();
CheckBoxSelectionModel<DeviceModel> sm = new CheckBoxSelectionModel<DeviceModel>();
columns.add(sm.getColumn());

ColumnModel cm = new ColumnModel(columns);


Then later on after the widget was initially rendered an event would add to it



columns.add(new ColumnConfig("MODELDATA_A", "ASDF", COLUMNWIDTH));
columns.add(new ColumnConfig("MODELDATA_B", "XYZ", COLUMNWIDTH));

grid.getColumnModel().setColumnHeader(0,grid.getColumnModel().getColumnHeader(0));


The last line seemed to be required to force the redraw. It seemed a bit of a hack but its what the app needed to redraw.

However it doesn't seem to work in since we have upgraded. Any ideas

Will

wmitchell
22 Jun 2010, 4:21 AM
bump :)

wmitchell
22 Jun 2010, 5:49 AM
Seems like I had to do the following to update the headers...


grid.getColumnModel().setColumnHeader(1, "TEXT1");
grid.getColumnModel().setDataIndex(1, "MODEL_DATA_A");
grid.getColumnModel().setColumnWidth(1, COLUMNWIDTH);

grid.getColumnModel().setColumnHeader(2, "TEXT2");
grid.getColumnModel().setDataIndex(2, "MODEL_DATA_B");
grid.getColumnModel().setColumnWidth(2, COLUMNWIDTH);