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):
ref
in the original code has been replaced withrenderTo
.ref
is used to set the currentComponent
into the named property on a parent container.renderTo
is 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 ofusercombo
the second version will render into nothing.name
is missing from the second definition.
Add triggerAction: 'all',
to the combobox configuration
精彩评论