extjs组合显示值

Vic*_*tor 2 extjs

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

编辑:只是为了澄清,我希望得到用户选择的项目的显示值.我希望在onselect或changeevent上显示警告.

sha*_*e87 5

如果将组合框上的valueField属性设置为要在警报中显示的值,该值将正常工作.

alert(combo.getValue());
Run Code Online (Sandbox Code Playgroud)

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

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.
  }
Run Code Online (Sandbox Code Playgroud)