简体   繁体   English

ExtJS 组合选择值

[英]ExtJS Combo selected value

Iam design ExtJs Combo and bind from database Iam 设计 ExtJs 组合并从数据库绑定

var AddEditPeopleStoreCompanyLocation = new Ext.data.JsonStore
        ({
            id: 'AddEditPeopleStoreCompanyLocation',
            fields: ['DID', 'Name'],
            url: '@Url.Content("~/Admin/GetCompanyLocations")',
            //data: [["1", "Head Quaters"], ["2", "Main"]],
            root: 'EntityArr',
            idProperty: 'KID',
            totalProperty: 'ArrayLength',
            remoteSort: true,
            autoDestroy: true,
            autoLoad: true
        });

my requirment is when i cilk on save button i have find out selected value of combo in controller for this iam using我的要求是当我点击保存按钮时,我找到了 controller 中选择的组合值,用于这个 iam

public void InsertOrUpdateContactDetails(FormCollection FC)
        {
//
}

so how to get selected value of combo in this above function thanks in advance那么如何在上面的 function 中获得选择的组合值提前谢谢

When you click the "save" button you have to run the "submit" method of the form panel's layout and send your Combobox value inside a parameter, example:当您单击“保存”按钮时,您必须运行表单面板布局的“提交”方法并在参数中发送您的 Combobox 值,例如:

var comboBox = new Ext.form.ComboBox({
    //...
    id: 'comboBox',
    name: 'comboBox'
});

var formPanel = new Ext.form.FormPanel({
    //...
    id: 'formPanel',
    items: [comboBox],
    buttons: [{
        text: 'Submit',
        handler: submitForm
    }]
});

var submitForm = function () {
        var formPanel = Ext.getCmp("formPanel")
        formPanel.form.submit({
            url: example.jsp,
            success: function (form, action) {
                alert("success")
            },
            failure: function (form, action) {
                alert("failure")
            }
        });
    };

Then you can use the comboBox parameter at server-side, it comes in "example.jsp".然后您可以在服务器端使用comboBox参数,它位于“example.jsp”中。

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

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