Version: SmartClient Version: v11.0p_2016-09-30/LGPL Development Only (built 2016-09-30)
Browser: Chrome Version 52.0.2743.116 m
One of the problems we have while upgrading our project to SmartGWT 6.0
One of our SelectItem form items will cause an exception when we add a value object to it. From what we can see, SmartGWT seems to call toString on an non-initialized instance of our item object.
I created a minimal case which shows this happening:
When running this, it will print ID as 0(Expected 1), and throw an exception on the return:
Browser: Chrome Version 52.0.2743.116 m
One of the problems we have while upgrading our project to SmartGWT 6.0
One of our SelectItem form items will cause an exception when we add a value object to it. From what we can see, SmartGWT seems to call toString on an non-initialized instance of our item object.
I created a minimal case which shows this happening:
Code:
public class TestClass { private String name = "TestName"; private static int IDCounter = 1; private int ID; public TestClass(String name) { ID = IDCounter++; this.name = name; } @Override public String toString() { Log.message("ID: " + ID); return "Name length: " + name.length(); } }
Code:
testSelectItem = new SelectItem(); testForm = new DynamicForm(); testForm.setItems(testSelectItem); testSelectItem.setValue(new TestClass("123"));
- TypeError: Cannot read property 'length' of undefined
- at $length_14_g$ (code-0.js:1150:26)
- at length__I__devirtual$_1_g$ (code-0.js:1789:10)
- at toString_127_g$ [as toString$] (code-0.js:293735:28)
- at _.toString (code-0.js:345:15)
- at Object.isc_isA_Date [as Date] (http://localhost:55020/code/sc/modul...Core.js:143:10)
- at Object.isc_FormItem__formatDataType [as $17c] (http://localhost:55020/code/sc/modul...orms.js:943:12)
- at Object.isc_FormItem_mapValueToDisplay [as mapValueToDisplay] (http://localhost:55020/code/sc/modul...Forms.js:935:9)
- at Object.isc_c_Class_invokeSuper [as invokeSuper] (http://localhost:55020/code/sc/modul...ore.js:273:162)
- at Object.isc_SelectItem_mapValueToDisplay [as mapValueToDisplay] (http://localhost:55020/code/sc/modul...rms.js:2079:13)
- at Object.isc_FormItem_getDisplayValue [as getDisplayValue] (http://localhost:55020/code/sc/modul...orms.js:931:13)
- at Object.isc_FormItem__showValue [as $124t] (http://localhost:55020/code/sc/modul...orms.js:981:13)
- at Object.isc_FormItem_setValue [as setValue] (http://localhost:55020/code/sc/modul...orms.js:978:28)
- at Object.isc_c_Class_invokeSuper [as invokeSuper] (http://localhost:55020/code/sc/modul...ore.js:273:162)
- at Object.isc_SelectItem_setValue [as setValue] (http://localhost:55020/code/sc/modul...ms.js:2072:912)
- at Object.isc_DynamicForm_setItemValues [as setItemValues] (http://localhost:55020/code/sc/modul...rms.js:379:163)
- at Object.isc_DynamicForm_setValues [as setValues] (http://localhost:55020/code/sc/modul...orms.js:275:22)
- at Object.isc_DynamicForm_initWidget [as initWidget] (http://localhost:55020/code/sc/modul...orms.js:211:49)
- at Object.isc_Canvas_init [as init] (http://localhost:55020/code/sc/modul...ore.js:2126:19)
- at Object.isc_Class_completeCreation [as completeCreation] (http://localhost:55020/code/sc/modul..._Core.js:323:6)
- at Object.isc_c_Class_create (http://localhost:55020/code/sc/modul...re.js:211:1837)
- at create_199_g$ (code-0.js:200521:48)
- at getOrCreateJsObj_6_g$ [as getOrCreateJsObj_14_g$] (code-0.js:85140:23)
- at addMember_2_g$ [as addMember_11_g$] (code-0.js:94414:37)
- at onModuleLoad_5_g$ (code-0.js:290756:19)
- at Array.init_2_g$ (code-0.js:46309:46)
- at initializeModules_0_g$ (code-0.js:221:30)
- at apply_0_g$ (code-0.js:11977:28)
- at entry0_0_g$ (code-0.js:12047:14)
- at code-0.js:12013:14
- at gwtOnLoad_0_g$ (code-0.js:234:40)
- at code-0.js:426181:1
Comment