Hello,
For some reason TreeGrid fires multiple rpc requests on fetchData calls. Reproducible with following code.
To reproduce:
1. check Track RPCs in development console RPC pane
2. click the fetch button many times
.. and notice that two rpc requests are always sent on fetch click. Is the code above bad somehow or is this a bug ?
Using 3.1d SNAPSHOT_v8.3d_2012-08-24/LGPL Development Only (built 2012-08-24), firefox 12.0, gwt 2.4.0.
For some reason TreeGrid fires multiple rpc requests on fetchData calls. Reproducible with following code.
Code:
private int dummyCriteria = 1; public void onModuleLoad() { SC.showConsole(); // our viewport viewport = new VLayout(); viewport.setWidth100(); viewport.setHeight100(); // data source with dummy data final DataSource ds = new DataSource(); DataSourceTextField pk = new DataSourceTextField("id"); pk.setPrimaryKey(true); DataSourceTextField text = new DataSourceTextField("text"); DataSourceTextField parent = new DataSourceTextField("parent"); parent.setForeignKey("id"); ds.setFields(pk, text, parent); ds.setClientOnly(true); ds.setTestData(gr(1, null), gr(2, 1), gr(3, 1), gr(4, 3)); // our treegrid final TreeGrid grid = new TreeGrid(); grid.setWidth(400); grid.setHeight(300); grid.setDataSource(ds); grid.setAutoFetchData(false); grid.setLoadDataOnDemand(false); final TreeGridField textField = new TreeGridField("text"); grid.setFields(textField); viewport.addMember(grid); // a button to fetch data to the grid Button button = new Button("fetch"); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // fetch with always changing criteria to force server fetch grid.fetchData(new Criteria("dummy", "" + dummyCriteria++)); } }); viewport.addMember(button); viewport.draw(); } public Record gr(int i, Integer parent) { Record r = new ListGridRecord(); r.setAttribute("id", "primarykey" + i); r.setAttribute("text", "node " + i); if(parent != null) r.setAttribute("parent", "primarykey" + parent); return r; }
1. check Track RPCs in development console RPC pane
2. click the fetch button many times
.. and notice that two rpc requests are always sent on fetch click. Is the code above bad somehow or is this a bug ?
Using 3.1d SNAPSHOT_v8.3d_2012-08-24/LGPL Development Only (built 2012-08-24), firefox 12.0, gwt 2.4.0.
Comment