ExtJS的组合选择的值

问题描述:

荫设计ExtJS的组合和绑定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 
     }); 

我需求量的是,当我使用保存按钮我必须找出组合的设定值在控制器 此IAM的Cilk

public void InsertOrUpdateContactDetails(FormCollection FC) 
     { 
// 
} 

所以如何提前

在这上面的函数获取所选组合的价值 感谢当你点击“保存”按钮你必须运行表单面板布局的“提交”方法和传递一个参数,比如里面的组合框的值:

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

然后你可以使用在服务器端的组合框参数,它有“ example.jsp”。

+1

如果您将“name:comboValue”添加到组合框的配置中,则无需粘贴表单提交的参数,formPanel.getForm()。submit将为您处理值检索。 – sdavids 2011-04-28 04:02:06

+0

没错,我会编辑我的答案 – 2011-04-28 09:46:52