0
votes

Iam design ExtJs Combo and bind from database

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

public void InsertOrUpdateContactDetails(FormCollection FC)
        {
//
}

so how to get selected value of combo in this above function thanks in advance

1

1 Answers

0
votes

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 :

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".