Display a ComboBox with a Json
Hye,
I'm a new user of extjs, and I've got an issue.
I have this Json :
Code:
{"total":"5", "corporates":[{"cop_id":"2","cop_name":"burode"},{"cop_id":"3","cop_name":"tag"},{"cop_id":"1","cop_name":"tagattitude"},{"cop_id":"4","cop_name":"test"},{"cop_id":"5","cop_name":"test2"}]}
I'm trying to display this in this comboBox using a Ext.data.Store and a Ext.data.JsonReader like this :
Code:
var ds = new Ext.data.Store({
reader: new Ext.data.JsonReader({
root: 'corporates'
, totalProperty: 'total'
}, [{name:'cop_id'}, {name:'cop_name'}])
});
var comboBox = new Ext.form.ComboBox({
store: ds,
mode: 'local',
valueField: 'cop_id',
displayField: 'cop_name',
applyTo: 'corporateList'
});
corporateList is here in my php file :
PHP Code:
<div>
<input type="text" id="corporateList" size="20"/>
</div>
The matter is that nothing is inside my ComboBox....
Is there someone to help me on this ?
Thanks a lot.