javascript - Combobox will not display loaded store data -
javascript - Combobox will not display loaded store data -
i using extjs 4.2 , when print store
in loadcombobox()
, items present, not appear in drop-down. drop-down empty.
here jsfiddle demo.
class="lang-js prettyprint-override">ext.define('reportfieldmodel', { extend: 'ext.data.model', fields: [{ 'name': 'name', 'type': 'string' }] }); ext.define('reportfieldcombostore', { extend: 'ext.data.jsonstore', model: 'reportfieldmodel' }); var config = { 'type': "summary", 'columns': [ "red", "yellow", "orange", "green", "blue", "indigo", "violet"] }; function processitem(item) { homecoming ext.create('reportfieldmodel', { name: item }); } function processitems(data) { var arr = []; if (data && data.length > 0) { (var = 0; < data.length; i++) { arr.push(processitem(data[i])); } } homecoming arr; } function loadcombobox(combo, data) { var store = combo.store; var columns = data.columns; var processed = processitems(columns); console.log(json.stringify(processed, undefined, 2)); store.loaddata(processed, false); } ext.onready(function () { var resultspanel = ext.create('ext.panel.panel', { title: 'results', width: 200, height: 400, renderto: ext.getbody(), layout: { type: 'vbox', align: 'stretch', padding: 5 }, items: [{ xtype: 'combo', itemid: 'mycombo', displayfield: 'name', valuefield: 'name', mode: 'local', store: ext.getstore('reportfieldcombostore') }] }); loadcombobox(resultspanel.down('#mycombo'), config); });
the config querymode
, not mode
.
javascript extjs store extjs4.2
Comments
Post a Comment