Skip to main content

Posts

Showing posts from June, 2014

ExtJS4 How to read and write nested data?

How to read nested JSON data Sample JSON like this: { id : 1234 , name : 'Aaron Smith' , address : { address1 : '1925 Isaac Newton Sq' , address2 : 'Suite 300' , city : 'Reston' , state : 'VA' , zip : 20190 } } Your corresponding Model definition would look like so: Ext . define ( 'User' , { extend : 'Ext.data.Model' , fields : [ 'id' , 'name' , { name : 'address1' , mapping : 'address.address1' }, { name : 'address2' , mapping : 'address.address2' }, { name : 'city' , mapping : 'address.city' }, { name : 'state' , mapping : 'address.state' }, { name : 'zip' , mapping : 'address.zip' } ] }); But what if address isn’t provided on all read requests? ...