【问题标题】:ExtJS Combo selected valueExtJS 组合选择值
【发布时间】:2011-08-13 15:53:23
【问题描述】:

我设计 ExtJs Combo 并从数据库绑定

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

我的要求是当我点击保存按钮时,我在控制器中找到了组合的选定值 为此我使用

public void InsertOrUpdateContactDetails(FormCollection FC)
        {
//
}

那么如何在上述函数中获取组合的选定值 提前致谢

【问题讨论】:

    标签: extjs


    【解决方案1】:

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

    【讨论】:

    • 如果在组合框的配置中添加“name:comboValue”,则不需要附加表单提交的参数,formPanel.getForm().submit 将处理该值为您检索。
    猜你喜欢
    • 2012-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-12
    • 1970-01-01
    • 2018-10-24
    • 1970-01-01
    • 2012-06-29
    相关资源
    最近更新 更多