繁体   English   中英

ExtJS 组合选择值

[英]ExtJS Combo selected value

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
        });

我的要求是当我点击保存按钮时,我找到了 controller 中选择的组合值,用于这个 iam

public void InsertOrUpdateContactDetails(FormCollection FC)
        {
//
}

那么如何在上面的 function 中获得选择的组合值提前谢谢

当您单击“保存”按钮时,您必须运行表单面板布局的“提交”方法并在参数中发送您的 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")
            }
        });
    };

然后您可以在服务器端使用comboBox参数,它位于“example.jsp”中。

暂无
暂无

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

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