简体   繁体   English

extjs4从组合框中获取选定的值

[英]extjs4 get selected value from combobox

Ok, this is driving me nuts again. 好的,这让我再次疯了。 I am trying to get the selected value from a combo box so I can update a grid with the correct data based on the user selection. 我试图从组合框中获取所选值,以便我可以根据用户选择使用正确的数据更新网格。 How do I do this? 我该怎么做呢?

I am using extjs 4 in MVC model. 我在MVC模型中使用extjs 4。 Here is my code: 这是我的代码:

my init inside the viewport: 我在视口内的init:

init: function() {
    this.control({
        'viewport > combobox': {
            select: this.onChangeStacker
        }
    });
},

// method with pseudocode of what I want to do
onChangeStacker: function(){

    selected =  getSelection;


   switch selected

    case == stk1

         load stk1

    case == stk2 

         load stkd
}
});
this.control({
    'viewport > combobox': {
        change: function(cmp) {
            var value = cmp.getValue();
            .
            .
            .
        }
    }
});​

Documentation: 文档:

Working example: http://jsfiddle.net/kMs86/ 工作示例: http//jsfiddle.net/kMs86/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM