javascript - How to bind array to arrystore in order to populate combo in extjs -


i having array as

var cars = new array('audi','benz','citron','nissan','alto'); 

i want add data arraystore below

 var mystore = new ext.data.arraystore({         data   : cars ,         fields : ['names']     }); 

on binding array store combo

 var mycombo = new ext.form.combobox({         store: mystore ,         displayfield: 'name',         valuefield: 'name',         typeahead: true,         mode: 'local',         forceselection: true,         triggeraction: 'all',         emptytext: 'select state...',         selectonfocus: true,      }); 

the combo showing first letter of each word in array a, b, c, n, a

how can disply combo arry using is populated programatically , binding arraystore

the format of data arraystore consumes array of arrays. reformatting store data follows should allow work:

var cars = [['audi'], ['benz'], ['citron'], ['nissan'], ['alto']]; 

converting format required format simple enough:

for ( var = 0, c = cars.length; < c; i++ ) {     cars[i] = [cars[i]]; } 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -