PDA

View Full Version : TreeGrid in AccordionLayout looses column width



denu
3 Jan 2012, 11:27 PM
Hi,

We have spotted a strange issue with TreeGrid placed inside ContentPanel with AccordionLayout.

There's a number of ContentPanels with TreeGrid inside each of them.
When you switch to another panel, resize its width then switch back to previous panel, the TreeGrid which was inside of it looses columns width defined at start. When you resize again ContentPanel width, TreeGrid fixes itself like the problem never existed.

See the screenshots and please tell if we can do something to deal with that?



List<ModelData> dataStore = parseTreeModel(panelItems);
createTreeSelection(dataStore);
TreeStore<ModelData> store = new TreeStore<ModelData>();

store.add(dataStore, true);
ColumnModel cm = createColumnModel();
CheckboxTreeGrid<ModelData> tree = new CheckboxTreeGrid<ModelData>(store, cm);

// tree.setAutoLoad(true);
tree.setAutoExpandColumn("name");
tree.setId("drzefko");
tree.setAutoLoad(true);
tree.setTrackMouseOver(false);
tree.getTreeView().setRowHeight(25);
tree.getStyle().setLeafIcon(null);// IconHelper.createStyle("icon-music"));
tree.setBorders(false);
tree.setCheckStyle(CheckCascade.TRI_STATE);
tree.setColumnResize(false);
tree.setHideHeaders(true);

Listener<CheckboxTreeGridEvent<ModelData>> checkListener = createCheckListener();
Listener<CheckboxTreeGridEvent<ModelData>> viewReadyListener = createViewReadyListener();
tree.addListener(Events.CheckChange, checkListener);
tree.addListener(Events.ViewReady, viewReadyListener);
new QuickTip(tree);
return tree;

30438

30439

30440

30441

catalin.ciobanu
4 Jan 2012, 8:06 AM
Hi I think I ran into this problem before and I solved it by simulating a resize .. fireevent resize. (You said when you resize a panel it solves your problem)

hope it helps

badbob
29 May 2012, 11:51 PM
Have the same issue. Did you solve it? Thanks for your answer.

denu
30 May 2012, 2:17 AM
Hi,
My teammate solved it, there was bug in autoExpand() method of TreeGridView class.

Here is code sample - try and say if it helped you as well:


protected void autoExpand(boolean preventUpdate) {
if (!userResized && grid.getAutoExpandColumn() != null) {
int tw = cm.getTotalWidth(false);
int aw = grid.el().getWidth(true) - getScrollAdjust();
if (aw <= 0) {
aw = grid.el().getStyleWidth() - getScrollAdjust();
}
if (tw != aw) {
int ci = cm.getIndexById(grid.getAutoExpandColumn());
assert ci != Style.DEFAULT : "auto expand column not found";
if (cm.isHidden(ci)) {
return;
}
int currentWidth = cm.getColumnWidth(ci);
int cw = Math.min(Math.max(((aw - tw) + currentWidth), grid.getAutoExpandMin()),
grid.getAutoExpandMax());
if (cw != currentWidth) {
cm.setColumnWidth(ci, cw, true);

if (!preventUpdate) {
updateColumnWidth(ci, cw);
}
}
}
}
}

badbob
30 May 2012, 10:14 PM
Thanks a lot. Your solution works fine. :D
I hope, developers will include this fix in next version.

denu
30 May 2012, 11:49 PM
No problem, mate . But I doubt Sencha will fix it, since its GXT 2.x issue and GXT 3.x is now the latest release. It has all components redesigned and written from a scratch I think.

Greetz