ipavlic
17 Oct 2012, 12:07 AM
This question is similar to http://www.sencha.com/forum/showthread.php?245817-Created-class-has-default-values-instead-of-undefined
(http://www.sencha.com/forum/showthread.php?245817-Created-class-has-default-values-instead-of-undefined)This time I'm interested why an array of children that belong to parent are initialized by an empty string instead of an empty Array or undefined. This breaks saving functionality as my server side expects an array, not a string.
Ext.define('MyApp.model.Parent', {
extend : 'Ext.data.Model',
hasMany : [ {
model : 'MyApp.model.Child',
name : 'children'
} ]
});
var parent = Ext.create('MyApp.model.Parent');
console.log(parent); //parent.data.children will be "" instead of 'undefined' or []
(http://www.sencha.com/forum/showthread.php?245817-Created-class-has-default-values-instead-of-undefined)This time I'm interested why an array of children that belong to parent are initialized by an empty string instead of an empty Array or undefined. This breaks saving functionality as my server side expects an array, not a string.
Ext.define('MyApp.model.Parent', {
extend : 'Ext.data.Model',
hasMany : [ {
model : 'MyApp.model.Child',
name : 'children'
} ]
});
var parent = Ext.create('MyApp.model.Parent');
console.log(parent); //parent.data.children will be "" instead of 'undefined' or []