ExtJS 组合框数组
我想使用以下数组创建一个组合框:
var operators = new Array(">=",">","=~","","!=","=","<","<=");
问题是我希望第一个元素(有时是最后一个元素)成为组合框的默认值。我找不到如何成功地做到这一点。
非常感谢,如果重复的话抱歉。
编辑
var ops = new Array(">=",">","=~","","!=","=","<","<=");
var operators = new Ext.data.ArrayStore({ id: 0, fields: [ 'value' ], data: ops });
Ext.getCmp('variablesAttributesPanel').add({xtype: 'combo', id: variables[j].getTitle() + 'MinCombo', mode: 'local', valueField: 'value', displayField: 'value', store: operators, width: 50, x: 240, y: (j * 20 + 19), editable: false, allowBlank: false});
这是使下拉列表中的选项>、=、、、!、<
有什么想法吗?
I want to create a combobox with the following array:
var operators = new Array(">=",">","=~","","!=","=","<","<=");
The issue is that I would like the first element (and sometimes the last element) to be the default value of the comboxbox. I could not find how to successfully do this.
Thanks so much and sorry if duplicate.
EDIT
var ops = new Array(">=",">","=~","","!=","=","<","<=");
var operators = new Ext.data.ArrayStore({ id: 0, fields: [ 'value' ], data: ops });
Ext.getCmp('variablesAttributesPanel').add({xtype: 'combo', id: variables[j].getTitle() + 'MinCombo', mode: 'local', valueField: 'value', displayField: 'value', store: operators, width: 50, x: 240, y: (j * 20 + 19), editable: false, allowBlank: false});
This is making the options in the dropdown list >, =, , !, <
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保在组合框配置中设置了triggerAction
triggerAction : 'all'
make sure triggerAction is set in combo box config
triggerAction : 'all'
使用组合框的 setValue 方法。在这种情况下,显示和值是相同的,因此您可以只传递数组值:
Use the setValue method of the combobox. In this case, the display and value are the same so you can just pass in the array value: