php - ExtJS String to Combobox -


i have php file returns string this

["item1","item2","item3","item4"] 

i need create combobox extjs. options must items 4 options. how if php link items.php. make things clear need combobox displayfield , valuefield have same values, item1 displayfield , valuefield. in advance!

p.s. string not json formatted, guess it's array store.

firstly, think have modify php script returns string @ least [["item1"],["item2"],["item3"],["item4"]]. otherwise have create own extjs reader or override ext.data.reader.array.read method.

secondly, store should this:

var store = ext.create('ext.data.store', {   fields: ['item'],   proxy: {     type: 'ajax',     url: '/items.php',     reader: {       type: 'array'     }   } } 

thirdly, combo config should this:

ext.create('ext.form.combobox', {   store: store,   displayfield: 'item',   valuefield: 'item' }); 

if decide use original php script anyway can take @ how define own reader (there json reader discussed, can figure out how implement code in array reader)


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -