javascript - Default selected value in a combobox -


i have combobox have in 2 types of laptops, toshiba , hp. on load selection default value nothing. want make default selected value toshiba, it's selected. such in html "selected". please?

laptops = ext.create('ext.data.store', {         fields: ['abbr','value', 'name'],         data : [             {"abbr":"tosh","value":"toshibatypes", "name":"toshiba"},             {"abbr":"hp","value":"hptypes", "name":"hp"}         ]     });        toshibatypes = ext.create('ext.form.panel', {             xtype: 'radiogroup',             defaulttype: 'radio',              layout: 'hbox',             border:false,             id: 'toshiba',             width:'100%',              items: [              {                 checked: true,                 boxlabel: 'toshiba 1',                 name: 'toshibas',                 inputvalue: 'toshiba1',                 xtype:'radiofield'             },              {                 boxlabel: 'toshiba 2',                 name: 'toshibas',                 inputvalue: 'toshiba2',                 xtype:'radiofield'             }         ]     });        hptypes = ext.create('ext.form.panel', {             xtype: 'radiogroup',             defaulttype: 'radio',              layout: 'hbox',             border:false,             id: 'hp',             width:'100%',              items: [              {                 checked: true,                 boxlabel: 'hp 1',                 name: 'hps',                 inputvalue: 'hp1',                 xtype:'radiofield'             },               {                 boxlabel: 'hp 2',                 name: 'hps',                 inputvalue: 'hp2',                 xtype:'radiofield'             }]     });            laptoptypes = ext.create('ext.form.combobox', {             store: laptops,             querymode: 'local',             displayfield: 'name',             valuefield: 'abbr',             editable:false,             width: 100,             onchange:onselectchange(this),         }); 

just set value of combobox value corresponding value store. if set valuefield 'abbr', 1 of values of 'abbr' of store can used.

laptoptypes = ext.create('ext.form.combobox', {     store: laptops,     querymode: 'local',     displayfield: 'name',     valuefield: 'abbr',     value: 'tosh',     editable:false,     width: 100,     onchange:onselectchange(this), }); 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -