-
26 Feb 2013 6:14 AM #1
Answered: Best Way to Model a List or Set of values
Answered: Best Way to Model a List or Set of values
What is the best way in Ext JS 4 to model a List or Set of String values returned from a REST call? I was trying to use a Model but that didn't work too well. I want to display a list of returned values in a Multiselect. Here is the returned JSON:
{"theList":[{"value":"something1"},{"value":"something2"},{"value":"something3"}]}
How would you create you model?
-
Best Answer Posted by EPV
Don't forget the "root" property in the reader.
Good luck!Code:Ext.define('MyModel', { extend: 'Ext.data.Model', fields: [ {name: 'value', type: 'string'} ], proxy: { type: 'rest', url : 'my.url', reader: { type: 'json', root : 'theList', } } });
-
26 Feb 2013 7:22 AM #2
Don't forget the "root" property in the reader.
Good luck!Code:Ext.define('MyModel', { extend: 'Ext.data.Model', fields: [ {name: 'value', type: 'string'} ], proxy: { type: 'rest', url : 'my.url', reader: { type: 'json', root : 'theList', } } });
-
26 Feb 2013 8:04 AM #3


Reply With Quote