Tuesday 15 May 2012

How to pass extra parameter to extjs combo

I have to one scenario, Suppose there are two combo ,I need to pass first one value as parameter of second combo query param.
Let say i have two combos in form
items:[
{
 fieldLabel: 'Customer Name',
 xtype:'customerlovcombo',
 width:550,
 id:'form-field-custproj-cust-name'
},
{
 fieldLabel: 'Project Name',
 xtype:'projectlovcombo',
 width:550,
 id:'form-field-custproj-proj-name'
}
]

Here i want to pass customerId as part of  proejctlovcombo.
What we need to do is in controller user beforequery to pass extra param as part of  proejctlovcombo

init: function() {
    '#form-field-custproj-proj-name':{
    beforequery:this.formatQuery
    }
},

formatQuery: function(queryEvent) {
var custName = Ext.getCmp('form-filed-cust-name').getRawValue();
 if(custName !=null && custName != ""){
  queryEvent.combo.getStore().getProxy().extraParams.custName=custName;
  }
}

No comments:

Post a Comment