Hello
I have a Listgrid which uses a Datasource where ClientOnly is True
Datasource has 2 fields - PrimaryKey and Text
I am populating datasource using datasource.addData
When grid first loads I can drag records to reorder.
I then add a new record to the grid calling grid.addData
I have ensured the new record gets a unique primary key and a text value
The new record appears, but if I drag to reorder I get a js error (below)
If I click the button a 2nd time to add another record the error occurs again, but the grid redraws and shows that the FIRST drag was successful
NB It doesn't matter if you drag the new records, or one of the existing ones.
Many thanks for your help
SmartClient Version: v8.3p_2012-12-13/LGPL Development Only (built 2012-12-13)
Browser=Firefox 19.0.2
Stack Trace
08:55:34.204:INFO:Log:initialized
08:55:36.041:INFO:Log:isc.Page is loaded
08:56:04.241:MUP5:WARN:Log:TypeError: _4 is null
Stack from error.stack:
unnamed(isc_ResultSet_reorderAllRow) @ atpeditor/sc/modules/ISC_DataBinding.js:1218
unnamed(isc_ResultSet_slideLis) @ atpeditor/sc/modules/ISC_DataBinding.js:1218
unnamed(isc_Canvas_transferRecord) @ atpeditor/sc/modules/ISC_Core.js:2439
unnamed(isc_ListGrid_recordDro) @ atpeditor/sc/modules/ISC_Grids.js:1762
unnamed(isc_ListGrid_dro) @ atpeditor/sc/modules/ISC_Grids.js:1762
unnamed(isc_Canvas_handleDro) @ atpeditor/sc/modules/ISC_Core.js:2115
unnamed(isc_c_EventHandler_bubbleEven) @ atpeditor/sc/modules/ISC_Core.js:1158
unnamed(isc_c_EventHandler_handleEven) @ atpeditor/sc/modules/ISC_Core.js:944
unnamed(isc_c_EventHandler_handleDragSto) @ atpeditor/sc/modules/ISC_Core.js:1099
unnamed(isc_c_EventHandler__handleMouseU) @ atpeditor/sc/modules/ISC_Core.js:1021
unnamed(isc_c_EventHandler_handleMouseU) @ atpeditor/sc/modules/ISC_Core.js:1018
unnamed(isc_c_EventHandler_dispatc) @ atpeditor/sc/modules/ISC_Core.js:1188
unnamed(anonymou) @ atpeditor/sc/modules/ISC_Core.js:41
unnamed() @
I have a Listgrid which uses a Datasource where ClientOnly is True
Datasource has 2 fields - PrimaryKey and Text
I am populating datasource using datasource.addData
When grid first loads I can drag records to reorder.
I then add a new record to the grid calling grid.addData
I have ensured the new record gets a unique primary key and a text value
The new record appears, but if I drag to reorder I get a js error (below)
If I click the button a 2nd time to add another record the error occurs again, but the grid redraws and shows that the FIRST drag was successful
NB It doesn't matter if you drag the new records, or one of the existing ones.
Many thanks for your help
SmartClient Version: v8.3p_2012-12-13/LGPL Development Only (built 2012-12-13)
Browser=Firefox 19.0.2
Stack Trace
08:55:34.204:INFO:Log:initialized
08:55:36.041:INFO:Log:isc.Page is loaded
08:56:04.241:MUP5:WARN:Log:TypeError: _4 is null
Stack from error.stack:
unnamed(isc_ResultSet_reorderAllRow) @ atpeditor/sc/modules/ISC_DataBinding.js:1218
unnamed(isc_ResultSet_slideLis) @ atpeditor/sc/modules/ISC_DataBinding.js:1218
unnamed(isc_Canvas_transferRecord) @ atpeditor/sc/modules/ISC_Core.js:2439
unnamed(isc_ListGrid_recordDro) @ atpeditor/sc/modules/ISC_Grids.js:1762
unnamed(isc_ListGrid_dro) @ atpeditor/sc/modules/ISC_Grids.js:1762
unnamed(isc_Canvas_handleDro) @ atpeditor/sc/modules/ISC_Core.js:2115
unnamed(isc_c_EventHandler_bubbleEven) @ atpeditor/sc/modules/ISC_Core.js:1158
unnamed(isc_c_EventHandler_handleEven) @ atpeditor/sc/modules/ISC_Core.js:944
unnamed(isc_c_EventHandler_handleDragSto) @ atpeditor/sc/modules/ISC_Core.js:1099
unnamed(isc_c_EventHandler__handleMouseU) @ atpeditor/sc/modules/ISC_Core.js:1021
unnamed(isc_c_EventHandler_handleMouseU) @ atpeditor/sc/modules/ISC_Core.js:1018
unnamed(isc_c_EventHandler_dispatc) @ atpeditor/sc/modules/ISC_Core.js:1188
unnamed(anonymou) @ atpeditor/sc/modules/ISC_Core.js:41
unnamed() @
Code:
import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.shared.GWT; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.fields.DataSourceIntegerField; import com.smartgwt.client.data.fields.DataSourceTextField; import com.smartgwt.client.docs.ClientOnlyDataSources; import com.smartgwt.client.util.KeyCallback; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; import com.smartgwt.client.widgets.layout.VLayout; /** * Entry point classes define <code>onModuleLoad()</code>. */ public class AtpEditor implements EntryPoint { private Integer iPrime=100; public void onModuleLoad() { RootPanel.get().add(makeDemo()); if (!GWT.isScript()) { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new KeyCallback() { public void execute(String keyName) { SC.showConsole(); } }); } } private Widget makeDemo() { VLayout vl=new VLayout(); final ListGrid grid=new ListGrid(); grid.setDataSource(makeDataSource()); grid.setCanReorderRecords(true); grid.setCanSort(false); grid.setAutoFetchData(true); grid.setWidth(400); grid.setHeight(400); vl.addMember(grid); Button btn=new Button("Add Record"); vl.addMember(btn); btn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { grid.addData(makeRecord(iPrime++)); } }); return vl; } private DataSource makeDataSource() { DataSource ds=new DataSource(); ds.setClientOnly(true); DataSourceIntegerField fId=new DataSourceIntegerField("ID", "ID"); fId.setPrimaryKey(true); DataSourceTextField fTxt=new DataSourceTextField("TEXT", "Text"); ds.setFields(fId,fTxt); for(int i=1; i<10;i++){ ds.addData(makeRecord(i)); } return ds; } private ListGridRecord makeRecord(int i) { ListGridRecord rec=new ListGridRecord(); rec.setAttribute("ID", i); rec.setAttribute("TEXT", "Item_"+String.valueOf(i)); return rec; } }
Comment