dedoz
19 Jan 2012, 9:05 PM
Hi, im trying to set the id property in a model, to the my own table id, in documentation says this can be done setting the idProperty in a model. so i did the following code, but still is sending the default id field (which is "id")
(im using ext-4.1.0-beta-1)
Ext.onReady(function() {
Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{name:'usrId' ,type:'int'},
{name:'usrLogin' ,type:'string'},
],
idProperty: 'usrId',
proxy:
{ type: 'direct',
api:{read : usrDefaultQuery.usrSelect}
}
});
User.load(3);
});
The request in console says : the post data (data sent) is
{"action":"usrDefaultQuery","method":"usrSelect","data":[{"id":3}],"type":"rpc","tid":1}
the id: 3 shouldnt be usrId : 3 ?
i know i can do User.load({params:{ usrId : 3} }) but i think is not the way , theres a reason for idProperty exists, also this load will send 2 paremeters, id and usrId.
(sorry for my english).
(im using ext-4.1.0-beta-1)
Ext.onReady(function() {
Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{name:'usrId' ,type:'int'},
{name:'usrLogin' ,type:'string'},
],
idProperty: 'usrId',
proxy:
{ type: 'direct',
api:{read : usrDefaultQuery.usrSelect}
}
});
User.load(3);
});
The request in console says : the post data (data sent) is
{"action":"usrDefaultQuery","method":"usrSelect","data":[{"id":3}],"type":"rpc","tid":1}
the id: 3 shouldnt be usrId : 3 ?
i know i can do User.load({params:{ usrId : 3} }) but i think is not the way , theres a reason for idProperty exists, also this load will send 2 paremeters, id and usrId.
(sorry for my english).