Hi Isomorphic,
please see the error for the following test case (using current 5.0p/5.1d):
I removed a field's new definition, but not the field itself and therefore passed a null-field to ListGrid.setFields(). The following exception I got in a unrelated position in the source file made me think I had problems with my criteria and as these did not turn out to be null, I assumed a SmartGWT or GWT bug, until I noticed the real reason.
Could you add null checks in setFields (perhaps also in DynamicForm (for it's FormItems) and BatchUploader (for setGridFields())?
Best regards
Blama
please see the error for the following test case (using current 5.0p/5.1d):
Code:
16:24:44.903 [ERROR] [builtinds] Unable to load module entry point class com.smartgwt.sample.client.BuiltInDS (see associated exception for details) [B]com.google.gwt.core.client.JavaScriptException: (TypeError) @com.smartgwt.client.widgets.grid.ListGrid::fetchData(Lcom/smartgwt/client/data/Criteria;)([Java object: com.smartgwt.client.data.AdvancedCriteria@1305601294]): _5[i] is null[/B] at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:252) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:137) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:589) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:315) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.smartgwt.client.widgets.grid.ListGrid.fetchData(ListGrid.java) at com.smartgwt.sample.client.BuiltInDS.recreate(BuiltInDS.java:89) at com.smartgwt.sample.client.BuiltInDS.onModuleLoad(BuiltInDS.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:423) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:530) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368) at java.lang.Thread.run(Unknown Source)
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.AdvancedCriteria; import com.smartgwt.client.data.Criterion; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.OperatorId; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; 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.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout mainLayout; private IButton recreateBtn; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); mainLayout = new VLayout(20); mainLayout.setWidth100(); mainLayout.setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(); } }); mainLayout.addMember(recreateBtn); recreate(); mainLayout.draw(); } private void recreate() { Window w = new Window(); w.setWidth("95%"); w.setHeight("95%"); w.setMembersMargin(0); w.setModalMaskOpacity(70); w.setTitle("Import data"); w.setShowMinimizeButton(false); w.setIsModal(true); w.setShowModalMask(true); w.centerInPage(); ListGrid lg = new ListGrid(DataSource.get("employees")); ListGridField employeeIdLGF = new ListGridField("EmployeeId"); ListGridField nameLGF = new ListGridField("Name"); ListGridField managerLGF = new ListGridField("ReportsTo"); managerLGF.setOptionDataSource(DataSource.get("employees")); managerLGF.setValueField("EmployeeId"); managerLGF.setDisplayField("Name"); ListGridField jobLGF = new ListGridField("Job"); ListGridField genderLGF = new ListGridField("Gender"); lg.setFields(employeeIdLGF, genderLGF, nameLGF, managerLGF, jobLGF, [B]null[/B]); /* * * * * * some unrelated code * * * * */ lg.fetchData(new AdvancedCriteria(new Criterion("EmployeeId", OperatorId.GREATER_OR_EQUAL, 100))); w.addItem(lg); w.show(); } }
Could you add null checks in setFields (perhaps also in DynamicForm (for it's FormItems) and BatchUploader (for setGridFields())?
Best regards
Blama
Comment