gpt4 book ai didi

Extjs 4.1 如何选择组合中的第一项

转载 作者:行者123 更新时间:2023-12-04 13:08:25 25 4
gpt4 key购买 nike

我有一个组合看起来像 http://jsfiddle.net/Q5nNV/

enter image description here

一切都很好,但是当我搜索(键入)一些文本时,例如 asdf组合框并单击清除按钮

这不是选择第一项,它看起来像

enter image description here

这是我的代码

var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data : [
{"abbr":"AK", "name":""},
{"abbr":"AL", "name":"Alabama"},
{"abbr":"AZ", "name":"Arizona"}
]
});

// Create the combo box, attached to the states data store
var combo = Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
triggerAction: 'all',
value: "AK",
queryMode: 'local',
displayField: 'name',
valueField: 'abbr',
trigger2Cls: 'x-form-clear-trigger',
onTrigger2Click: function (args) {
this.setValue("AK");
},
tpl: new Ext.XTemplate('<tpl for=".">' + '<li style="height:22px;" class="x-boundlist-item" role="option">' + '{name}' + '</li></tpl>'),
renderTo: Ext.getBody()
});

我想当我点击清除按钮时,我的组合将选择第一个项目(空项目)。怎么解决谢谢

最佳答案

这对我有用

var combo = Ext.getCmp('myId');
combo.select(combo.getStore().getAt(0));

关于Extjs 4.1 如何选择组合中的第一项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17996310/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com