PDA

View Full Version : Link combobox with a checkbox in a grid



satti
16 Jan 2012, 7:37 PM
Link combobox with a checkbox in a grid

I am using a grid in which I want to change the contents of combobox on checkbox values, by default the checkbox should be checked. The combobox is readonly and its value is changed via the values of checkbox.

eg: If checked the value of the combobox be 'Approve' and if unchecked the value of combobox be 'Reject'

Also I am using custom checkbox api to show checkbox in a grid which is shown below.

"Ext.grid.CheckColumn = function(config){
Ext.apply(this, config);
if(!this.id){
this.id = Ext.id();
}
this.renderer = this.renderer.createDelegate(this);

};

Ext.grid.CheckColumn.prototype ={

init : function(grid){

this.grid = grid;

this.grid.on('render', function(){

var view = this.grid.getView();

view.mainBody.on('mousedown', this.onMouseDown, this);

}, this);

},

onMouseDown : function(e, t){

if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){

e.stopEvent();

var index = this.grid.getView().findRowIndex(t);

var record = this.grid.store.getAt(index);

record.set(this.dataIndex, !record.data[this.dataIndex]);

}
},
renderer : function(v, p, record){

p.css += ' x-grid3-check-col-td';

return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'"> </div>';
}
};"

Thanks!

Satti

mitchellsimoens
16 Jan 2012, 8:49 PM
You just need to set the record's field that is associated to the checkcolum.

Also, please wrap your code in code tags.

vikrip
1 Jan 2014, 4:03 AM
Hi All,

In FormPanel,when i select country, i want show corresponding states in that Country. please provide sample code of MVC. ASAP