簡體   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