Monday, June 20, 2011

Ext JS : Data Model proxy for Json and XML return type

JSON RETURN DATA

If you data is returned in JSON format then your proxy for Data Model will look like :
Ext.define("Post", {
extend: 'Ext.data.Model',
proxy:
{
type: 'rest',
url : 'http://xyz.com/ID/18/',
reader: {
type: 'json',
root: 'CUSTOMER'
}
}



XML Return Data

Ext.define("Post", {
extend: 'Ext.data.Model',
proxy: {
type: 'ajax',
url : 'http://xyz.com/ID/18',
reader: {
type: 'xml',
record: 'CUSTOMER'
}
},

No comments: