mardi 27 janvier 2015

Extjs5 - idProperty dosen't take effect

I have defined a custom Ext.Model, which is called itrip.model.City, And the primary key of this model is cityId, so I changed the default idProperty from 'id' to 'cityId', but it turns out a little bit werid, when I call Ext.model.load() to request my server, the actual request url turns out to be


http://localhost:8080/admin/city?_dc=1422349415598&id=itrip.model.City-1


see the param is still 'id' and the value is 'itrip.model.City-1', I don't know how is this come about. hope anyone could help :-)


heres my code:





Ext.define('itrip.model.City', {
extend: 'Ext.data.Model',
alias: 'city',
idProperty: 'cityId',
fields: [
{name: 'cityId', type: 'int'},
{name: 'countryId', type: 'int'},
{name: 'cityNameZh', type: 'string'},
{name: 'cityNameEn', type: 'string'},
{name: 'cityCode', type: 'string'},
{name: 'show', type: 'int'}
],
proxy: {
type: 'ajax',
url: 'city',
}
});

var city = itrip.model.City.load(1, {
success: function(city1) {
//omit...
}
);







Aucun commentaire:

Enregistrer un commentaire