populating combobox extjs in rails
i have designed a form in extjs and exported proj to my rails appn.. soo 2 files that i am playing with is MyPanel.ui.js & MyPanel.js i want to populate combobox with json store.. when i w开发者_C百科rote below code :
{ xtype: 'combo',
name:'username',
id:'usercombo',
ref:'usercombo',
store:'RoleStore', autoShow:true,
displayField:'username',
valueField:'username',
mode: 'local'
}
But when i write similar code in MyPanel.js, it does not work:
var combo1 = new Ext.form.ComboBox({
store:'RoleStore', autoShow:true,
displayField:'username',
valueField:'username',
mode: 'local',
triggerAction: 'all',
renderTo: 'usercombo'});`
I have followed link : http://bytes.com/topic/javascript/answers/887318-how-populate-combobox-data-extjs-2-3-a
Two possible issues I can see (you don't elaborate as to how it doesn't work):
refin the original code has been replaced withrenderTo.refis used to set the currentComponentinto the named property on a parent container.renderTois used to give the id of the DOM element, Ext element, etc, that the component is to be rendered to. If there's no element with an id ofusercombothe second version will render into nothing.nameis missing from the second definition.
Add triggerAction: 'all', to the combobox configuration
加载中,请稍侯......
精彩评论