gpt4 book ai didi

extjs组合显示值

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

在 ext js 中,当我有一个组合时,会有显示值和值(发送到服务器)。我不需要将 displayValue 发送到服务器,但我需要在页面上捕获它并显示警报。执行此操作的 eextjs 方法是什么?combo.getValue() 将返回基础值...我没有看到任何 combo.getDisplay()

编辑:澄清一下,我希望获得用户选择的项目的显示值。我希望在 onselect 或 changevent 上显示警报。

最佳答案

如果您将组合框上的 valueField 属性设置为您希望在警报中显示的值,这将正常工作。

alert(combo.getValue());

如果您希望此值不同于您提交给服务器的值,您将必须从组合框中获取商店并找到相应的记录。

var store = combo.getStore();
var index = store.find('*YourFieldName*', combo.getValue());
if(index != -1)//the record has been found
{
var record = store.getAt(index);
//you can then do what you like with the record.
}

关于extjs组合显示值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4877288/

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