Isomorphic,
I'm using SmartClient Version: v10.1p_2016-03-11/Pro Deployment (built 2016-03-11) and I get the following warnings when calling setData (with a different set of records) on the listgrid if any of its rows are expanded.
The following test case can be used to reproduce the problem.
1. Click on the "Test Data 1" button.
2. Expand one of the rows.
3. Click on the "Test Data 2" button.
Also, should the expanded rows be preserved when switching between Test Data 1 and Test Data 2 if the primary key is the same? For example, if you click on "Test Data 1", expand "A" and then click on "Test Data 2"?
Thanks.
I'm using SmartClient Version: v10.1p_2016-03-11/Pro Deployment (built 2016-03-11) and I get the following warnings when calling setData (with a different set of records) on the listgrid if any of its rows are expanded.
Code:
10:13:11.939:MUP2:WARN:ListGrid:isc_Sandbox5_1_0:findRowNum(): Attempt to find row number on dataBound grid. Target record has no primary keys. Typically this is only supported where listGrid.saveLocally is true. Specified primaryKeys are :{fldId: 1} 10:13:11.967:MUP2:WARN:Log:com.google.gwt.core.client.JavaScriptException: (TypeError) __gwt$exception: <skipped>: Cannot read property 'length' of undefined at isc_ListGrid__remapEmbeddedComponents(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@7:2105) at isc_ListGrid_dataChanged(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@67:1091) at <anonymous>(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@342:1049) at observation(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@378:331) at isc_Arra_sortByProperties(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@46:1156) at isc_Arra_setSort(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@13:1129) at isc_ListGrid_applySortToData(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@11:2757) at isc_ListGrid_setSort(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@27:2737) at isc_ListGrid_setData(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Grids.js@28:978) at isc_Class_setProperties(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@109:346) at isc_Class_setProperty(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@1296:345) at $setProperty_1(sandbox5-0.js@10:5364) at $setAttribute_4(sandbox5-0.js@43:5327) at $setData(sandbox5-0.js@3:6056) at onClick_0(sandbox5-0.js@3:6762) at $dispatch(sandbox5-0.js@11:19439) at dispatch_0(sandbox5-0.js@3:19454) at dispatch(sandbox5-0.js@8:1426) at dispatchEvent_0(sandbox5-0.js@11:1549) at $doFire(sandbox5-0.js@9:1601) at $fireEvent_0(sandbox5-0.js@3:1644) at $fireEvent(sandbox5-0.js@5:1500) at $fireEvent_1(sandbox5-0.js@44:4870) at fireEvent_0(sandbox5-0.js@3:4885) at anonymous(sandbox5-0.js@11:5729) at apply_0(sandbox5-0.js@23:471) at entry0(sandbox5-0.js@16:541) at anonymous(sandbox5-0.js@16:515) at obj.click(sandbox5-0.js@17:5753) at isc_StatefulCanvas_handleActivate(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Foundation.js@108:230) at isc_StatefulCanvas_handleClick(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Foundation.js@13:231) at isc_c_EventHandler_bubbleEvent(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@89:1651) at isc_c_EventHandler_handleClick(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@50:1511) at isc_c_EventHandler__handleMouseUp(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@11:1496) at isc_c_EventHandler_handleMouseUp(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@57:1487) at isc_c_EventHandler_dispatch(http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@108:1725) at eval(eval at isc__makeFunction (http://127.0.0.1:8888/sandbox5/sc/modules/ISC_Core.js@122:76)
1. Click on the "Test Data 1" button.
2. Expand one of the rows.
3. Click on the "Test Data 2" button.
Code:
public void onModuleLoad() { VLayout layout = new VLayout(10); DataSource testDs = new DataSource(); testDs.setClientOnly(true); DataSourceIntegerField fldId = new DataSourceIntegerField("fldId"); fldId.setPrimaryKey(true); DataSourceTextField fld1 = new DataSourceTextField("fld1"); DataSourceIntegerField fld2 = new DataSourceIntegerField("fld2"); testDs.setFields(fldId, fld1, fld2); final ListGrid grid = new ListGrid() { @Override protected Canvas getExpansionComponent(ListGridRecord record) { Canvas canvas = super.getExpansionComponent(record); canvas.setMargin(5); return canvas; } }; grid.setWidth(600); grid.setHeight(500); grid.setDataSource(testDs); grid.setSortField("fld1"); grid.setCanExpandRecords(true); grid.setExpansionMode(ExpansionMode.DETAIL_FIELD); grid.setDetailField("fld2"); ListGridField gfld1 = new ListGridField("fld1", "Field 1"); grid.setFields(gfld1); layout.addMember(grid); HLayout buttonLayout = new HLayout(10); IButton testData1Button = new IButton("Test Data 1"); testData1Button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { grid.setData(getTestData1()); } }); buttonLayout.addMember(testData1Button); IButton testData2Button = new IButton("Test Data 2"); testData2Button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { grid.setData(getTestData2()); } }); buttonLayout.addMember(testData2Button); layout.addMember(buttonLayout); layout.draw(); } private static ListGridRecord[] getTestData1() { ListGridRecord[] testData1 = new ListGridRecord[3]; testData1[0] = new ListGridRecord(); testData1[0].setAttribute("fldId", 1); testData1[0].setAttribute("fld1", "A"); testData1[0].setAttribute("fld2", 10); testData1[1] = new ListGridRecord(); testData1[1].setAttribute("fldId", 2); testData1[1].setAttribute("fld1", "B"); testData1[1].setAttribute("fld2", 20); testData1[2] = new ListGridRecord(); testData1[2].setAttribute("fldId", 3); testData1[2].setAttribute("fld1", "C"); testData1[2].setAttribute("fld2", 30); return testData1; } private static ListGridRecord[] getTestData2() { ListGridRecord[] testData2 = new ListGridRecord[2]; testData2[0] = new ListGridRecord(); testData2[0].setAttribute("fldId", 1); testData2[0].setAttribute("fld1", "A"); testData2[0].setAttribute("fld2", 10); testData2[1] = new ListGridRecord(); testData2[1].setAttribute("fldId", 2); testData2[1].setAttribute("fld1", "D"); testData2[1].setAttribute("fld2", 40); return testData2; }
Thanks.
Comment