Hi,
SC_SNAPSHOT-2011-03-24/EVAL Deployment
FireFox 3.6.16
I wanted to reproduce an error that we are having in our real app.
However, I don't seem to be able to use a test datasource, datapath and a listgrid together.
This is blocking me setting up the real repo case.
In my standalone test case you will see a grid and a form.
In the form the value of the boolean is correctly set (interpreted), but in the grid it is not?
Moreover, if you try to edit the boolean in the grid you get a nullpointer.
Keep in mind, I'm not seeing this behavior in our real app (there it all works fine on both grid and form, both using dataPath).
So, I'm guessing it has something to do with the test datasource?!?
Regards,
Bart
SC_SNAPSHOT-2011-03-24/EVAL Deployment
FireFox 3.6.16
I wanted to reproduce an error that we are having in our real app.
However, I don't seem to be able to use a test datasource, datapath and a listgrid together.
This is blocking me setting up the real repo case.
In my standalone test case you will see a grid and a form.
In the form the value of the boolean is correctly set (interpreted), but in the grid it is not?
Moreover, if you try to edit the boolean in the grid you get a nullpointer.
Keep in mind, I'm not seeing this behavior in our real app (there it all works fine on both grid and form, both using dataPath).
So, I'm guessing it has something to do with the test datasource?!?
Regards,
Bart
Code:
Uncaught JavaScript exception [_2 is null] in http://127.0.0.1:8888/standalone/sc/modules/ISC_Core.js, line 3387
Code:
public class Standalone implements EntryPoint { private static Canvas masterPanel = null; boolean pickerShowing = false; public void onModuleLoad() { devConsole = new Button("DEV Console"); devConsole.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { public void onClick(ClickEvent event) { SC.showConsole(); } }); //masterPanel should be a Layout masterPanel = new Canvas(); masterPanel.setHeight100(); masterPanel.setWidth100(); masterPanel.setStyleName("pageBackground"); //background style from skin masterPanel.addChild(testCase11()); masterPanel.draw(); } public VLayout testCase11() { VLayout test = new VLayout(); test.setWidth100(); test.setHeight100(); MyCheckBoxEditor editor = new MyCheckBoxEditor(); editor.setDataPath("checkBoxField1/booleanValue"); DataSourceField pkField = new DataSourceField(); pkField.setName("primaryKey"); pkField.setType(FieldType.SEQUENCE); pkField.setPrimaryKey(true); pkField.setHidden(false); DataSourceField myCheckBoxField = new DataSourceField(); myCheckBoxField.setName("checkBoxField1"); myCheckBoxField.setTitle("checkBoxField1"); myCheckBoxField.setType(new MyCheckBoxType()); myCheckBoxField.setEditorType(editor); JavaScriptObject jsObject = JSOHelper.createObject(); JSOHelper.setAttribute(jsObject, "booleanValue", Boolean.FALSE); ListGridRecord[] result = new ListGridRecord[1]; result[0] = new ListGridRecord(); result[0].setAttribute("checkBoxField1", jsObject); result[0].setAttribute("primaryKey", 1); DataSource dataSource = new DataSource(); dataSource.setID("testDS"); dataSource.setFields(pkField, myCheckBoxField); dataSource.setClientOnly(true); dataSource.setTestData(result); //the order list grid final DynamicForm form = new DynamicForm(); form.setHeight(170); form.setWidth(500); form.setDataSource(dataSource); form.setAutoFetchData(true);//!!! final ListGrid grid = new ListGrid(); grid.setEditByCell(true); grid.setShowAllRecords(true); grid.setHeight(170); grid.setWidth(500); grid.setCanEdit(true); grid.setDataSource(dataSource); grid.setAutoFetchData(true);//!!! grid.setShowRowNumbers(false); Button showRowNumbers = new Button("show row numbers"); showRowNumbers.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if(!grid.getShowRowNumbers()){ grid.setShowRowNumbers(true); grid.refreshFields(); } else{ grid.setShowRowNumbers(false); grid.refreshFields(); } } }); test.addMember(grid); test.addMember(showRowNumbers); test.addMember(form); return test; } } public static class MyCheckBoxType extends SimpleType { public MyCheckBoxType() { super("myCheckBoxType", FieldType.BOOLEAN); } } private class MyCheckBoxEditor extends CheckboxItem { public MyCheckBoxEditor() { super(); this.setAllowEmptyValue(true); this.setShowUnsetImage(true); } }
Comment