-
27 Jan 2012 5:11 AM #1
[GXT 2.2.4] Bug on GridCellRenderer for TreeGrid
[GXT 2.2.4] Bug on GridCellRenderer for TreeGrid
Hi,
I have some issues on widget renderer when I try to scroll with the mouse wheel.
Some widgets are not rerendering correctly.
here is a simple source code producing the bug :
The result optained :Code:import java.util.Arrays; import com.extjs.gxt.samples.resources.client.Resources; import com.extjs.gxt.samples.resources.client.TestData; import com.extjs.gxt.samples.resources.client.model.Folder; import com.extjs.gxt.ui.client.data.ModelData; import com.extjs.gxt.ui.client.store.ListStore; import com.extjs.gxt.ui.client.store.TreeStore; import com.extjs.gxt.ui.client.widget.ContentPanel; import com.extjs.gxt.ui.client.widget.LayoutContainer; import com.extjs.gxt.ui.client.widget.form.CheckBox; import com.extjs.gxt.ui.client.widget.grid.ColumnConfig; import com.extjs.gxt.ui.client.widget.grid.ColumnData; import com.extjs.gxt.ui.client.widget.grid.ColumnModel; import com.extjs.gxt.ui.client.widget.grid.Grid; import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; import com.extjs.gxt.ui.client.widget.layout.FitLayout; import com.extjs.gxt.ui.client.widget.layout.FlowLayout; import com.extjs.gxt.ui.client.widget.treegrid.TreeGrid; import com.extjs.gxt.ui.client.widget.treegrid.TreeGridCellRenderer; import com.google.gwt.user.client.Element; public class TreeGridExample extends LayoutContainer { @Override protected void onRender( Element parent, int index ) { super.onRender( parent, index ); setLayout( new FlowLayout( 10 ) ); Folder model = TestData.getTreeModel(); TreeStore<ModelData> store = new TreeStore<ModelData>(); for ( int i = 0; i < 10; i++ ) { store.add( model.getChildren(), true ); } ColumnConfig cBox = new ColumnConfig( "cBox", "cBox", 20 ); cBox.setRenderer( new GridCellRenderer<ModelData>() { @Override public Object render( ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ModelData> store, Grid<ModelData> grid ) { final CheckBox checkBox = new CheckBox(); checkBox.setValue( rowIndex % 2 == 1 ); return checkBox; } } ); ColumnConfig name = new ColumnConfig( "name", "Name", 100 ); name.setRenderer( new TreeGridCellRenderer<ModelData>() ); ColumnModel cm = new ColumnModel( Arrays.asList( cBox, name ) ); ContentPanel cp = new ContentPanel(); cp.setLayout( new FitLayout() ); cp.setSize( 600, 300 ); final TreeGrid<ModelData> tree = new TreeGrid<ModelData>( store, cm ); tree.getStyle().setLeafIcon( Resources.ICONS.music() ); tree.setAutoExpandColumn( "name" ); cp.add( tree ); add( cp ); } }
screen_bug_treegrid.png
Thank you
-
30 Jan 2012 2:34 AM #2
I am having the same problems with Widget Renderer TreeGrid. Like in example (you can see the attachement) I created custom renderer for my grid. But after some operations (i.e. open all leaves and start collapsing-expanding them) some widgets get lost and not displayed.
-
21 Feb 2012 2:37 AM #3
Same problem on ie (works fine on firefox)!!!
to gwt developpers is passed almost 2 months and no answear!
-
21 Feb 2012 2:39 AM #4
It is on the list and will be worked on for one of the upcomming releases.
-
21 Feb 2012 3:07 AM #5
-
21 Feb 2012 4:58 AM #6
This code seemed to fix the issue
No un-displayed widgets in grid, but I doubt it's the good solution in performance aspect.Code:grid.getTreeView().setBufferEnabled(false);
-
21 Feb 2012 5:00 AM #7
If performance is relevant, you should not use widgets in a Grid at all. Try to use plain html instead.
-
21 Feb 2012 6:00 AM #8
The problem seems to be that in IE when you scroll/filter it makes getWidget()... For some reason the widget already build gets a bad html. So, for the moment the problem is solved by rebuilding the widget everytime (checkbox in my case) with listeners and everything. It's not so good for performance but it seems more stable. Will see what the tests in time will give.
-
21 Feb 2012 8:00 AM #9
Actually I've got this problem on firefox.
I also had it on a grid.
-
21 Feb 2012 8:47 AM #10
Its a bug in BufferView. Please try this patch:
Code:Index: user/src/com/extjs/gxt/ui/client/widget/grid/BufferView.java=================================================================== --- user/src/com/extjs/gxt/ui/client/widget/grid/BufferView.java (revision 2479) +++ user/src/com/extjs/gxt/ui/client/widget/grid/BufferView.java (working copy) @@ -335,7 +335,7 @@ if (!isRowRendered(i)) { List<ModelData> list = new ArrayList<ModelData>(); list.add(store.getAt(i)); - widgetList.add(i, new ArrayList<Widget>()); + widgetList.set(i, new ArrayList<Widget>()); String html = doRender(cs, list, i, cc, stripe, true); getRow(i).setInnerHTML(html); renderWidgets(i, i);
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote