asp.net - in extjs error in fill combo with ajax request -
working code:
var customstore = new ext.data.store({ model: 'user', proxy: { type: 'ajax', url: 'http://test/service1.svc/getoperator', pageparam: false, startparam: false, limitparam: false, nocache: false, params: { storeid: 31 }, autosync: true, reader: { type: 'json', root: 'users' } }, autoload: true });
ext.define('user', { extend: 'ext.data.model', fields: [ { name: 'staffid', type: 'string' }, { name: 'name', type: 'string' } ] });
declare bind
}, { id: 'cmbappoperator', itemid: 'operatorid', name: ext.calendar.data.eventmappings.operatorid.name, fieldlabel: 'operator', xtype: 'combo', anchor: '60%', store: customstore, valuefield: 'staffid', displayfield: 'name', querymode: 'local', allowblank: false },
this working code below json
but error same change in url request
the json responce below:
[ { "name": "-any operator-", "staffid": 0 }, { "name": "aa manzie", "staffid": 37 }, { "name": "tttt sadsad", "staffid": 33 } ]
"{\"operatorlistforappointment\":[{\"name\":\" operator \",\"operatorid\":0},{\"name\":\"aa manzie\",\"operatorid\":37}]}"
below code
var customstore = new ext.data.store({
model: 'user', proxy: { type: 'ajax', limitparam: 'false', nocache: false, pageparam: 'false', startparam: 'false', url: 'https://test/pos/salesservice.svc/getoperatorlistforappointments', params: { storeid: 31, shiftdate: '2016-07-05 04:29:36.840', databasename: 'db_test' }, autosync: true, reader: { type: 'json', root: 'users' } }, autoload: true });
ext.define('user', { extend: 'ext.data.model', fields: [ { name: 'operatorid', type: 'string' }, { name: 'name', type: 'string' } ] });
}, { id: 'cmbappoperator', itemid: 'operatorid', name: ext.calendar.data.eventmappings.operatorid.name, fieldlabel: 'operator', xtype: 'combo', anchor: '60%', store: customstore, valuefield: 'operatorid', displayfield: 'name', querymode: 'local', allowblank: false },
i confused please let me know wrong.
the root property has defined operatorlistforappointment in store proxy instead of users response json contains array attribute operatorlistforappointment.
Comments
Post a Comment