开发者

populating combobox extjs in rails

开发者 https://www.devze.com 2023-02-22 15:09 出处:网络
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 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):

  1. ref in the original code has been replaced with renderTo. ref is used to set the current Component 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 of usercombo the second version will render into nothing.
  2. name is missing from the second definition.


Add triggerAction: 'all', to the combobox configuration

0

精彩评论

暂无评论...
验证码 换一张
取 消