Rothariger
31 Jul 2012, 6:46 AM
Hi,
i'm working in a small project and i want to use the ext.data.model, the thing is that i having some problems when i want to load some data.
here is the model declaration.
Ext.define('Model.Item',{
extend: 'Ext.data.Model',
fields: ['id', 'code', 'description'],
proxy: {
type: 'ajax',
api: {
read: 'Handlers/Item.ashx',
create: 'Handlers/Item.ashx?action=create',
destroy: 'Handlers/Item.ashx?action=delete',
update: 'Handlers/Item.ashx?action=update'
},
reader: {
type: 'json',
root: 'items'
},
writer: {
type: 'json',
writeAllFields: true,
root: 'data',
allowSingle: false
}
}
});
and i using it with a jsonstore like this.
new Ext.data.JsonStore({
storeId: 'mainStore',
autoLoad: true,
model: 'Model.Item'
})
binging it with a grid, before i wasnt using model, and was working just fine. no i cant get it to work.
i get an exception in ext-all.js
urlAppend : function(url, string) {
if (!Ext.isEmpty(string)) {
return url + (url.indexOf('?') === -1 ? '?' : '&') + string;
}
return url;
},
this funcion is called from Ext.data.proxy.Server in the buildUrl function.
well any help would be appreciated.
i'm working in a small project and i want to use the ext.data.model, the thing is that i having some problems when i want to load some data.
here is the model declaration.
Ext.define('Model.Item',{
extend: 'Ext.data.Model',
fields: ['id', 'code', 'description'],
proxy: {
type: 'ajax',
api: {
read: 'Handlers/Item.ashx',
create: 'Handlers/Item.ashx?action=create',
destroy: 'Handlers/Item.ashx?action=delete',
update: 'Handlers/Item.ashx?action=update'
},
reader: {
type: 'json',
root: 'items'
},
writer: {
type: 'json',
writeAllFields: true,
root: 'data',
allowSingle: false
}
}
});
and i using it with a jsonstore like this.
new Ext.data.JsonStore({
storeId: 'mainStore',
autoLoad: true,
model: 'Model.Item'
})
binging it with a grid, before i wasnt using model, and was working just fine. no i cant get it to work.
i get an exception in ext-all.js
urlAppend : function(url, string) {
if (!Ext.isEmpty(string)) {
return url + (url.indexOf('?') === -1 ? '?' : '&') + string;
}
return url;
},
this funcion is called from Ext.data.proxy.Server in the buildUrl function.
well any help would be appreciated.