PDA

View Full Version : how to put renderer in checkcolumn grid ??



poojagarg89
1 Mar 2012, 1:41 AM
I have a grid which consist of 5 checkcolumns in which the last one is ALL means if in one row I check on ALL's column checkbox then it should make other column checkboxes as checked of that row and if I again uncheck the ALL column checkbox then it should uncheck all other four column checkboxes

my code is


var permissions_D_inventory_displaycheck = new Ext.grid.CheckColumn({id:'display1',header: 'Display',align:'center',sortable: true,dataIndex: 'display',width: 100});
var permissions_D_inventory_newcheck = new Ext.grid.CheckColumn({id:'new11',align:'center',header: "New",width:100, sortable: true, dataIndex:'new1'});
var permissions_D_inventory_editcheck = new Ext.grid.CheckColumn({id:'edit1',align:'center',header: "Edit",width:100, sortable: true,dataIndex:'edit'});
var permissions_D_inventory_deletecheck = new Ext.grid.CheckColumn({id:'delete_11',align:'center',header: "Delete",width:100, sortable: true, dataIndex:'delete_1'});
var permissions_D_inventory_allcheck = new Ext.grid.CheckColumn({id:'all11',align:'center',header: "All",width:100, sortable: true,dataIndex:'all1',
//listeners :
// {
// checkchange : function(column, recordIndex, checked)
// {
// alert(checked);
// //or send a request
// }
// }
//renderer : function(value) {
// alert(value);
//}

});
var permissions_D_inventory_colmod=new Ext.grid.ColumnModel([{id:'modules1',align:'center',header: "Modules",width:100, sortable: true, dataIndex:'modules'},
permissions_D_inventory_displaycheck,
permissions_D_inventory_newcheck,
permissions_D_inventory_editcheck,
permissions_D_inventory_deletecheck,
permissions_D_inventory_allcheck
//renderer : function(all1,p,record){
//alert(all1);
//}
]);

var permissions_D_inventorygrid=new Ext.grid.EditorGridPanel({
id:'permissions_D_inventorygrid',
layout:'fit',
store:permissions_D_inventory_ds,
cm:permissions_D_inventory_colmod,
clicksToEdit:1,
title:"Inventory",
width: 200,
height:180,
plugins:[permissions_D_inventory_displaycheck,permissions_D_inventory_newcheck,permissions_D_inventory_editcheck,permissions_D_inventory_deletecheck,permissions_D_inventory_allcheck],
anchor:'1',
frame:true,
loadMask: true,
viewConfig:
{
forceFit:true
},
collapsible: false,
animCollapse: false,
stripeRows:true,
autoScroll:true,
iconCls:'icon-grid'
});


Here is the image:

32266

but m not getting how to do it.....please help me out

Thanks,
Pooja

mitchellsimoens
1 Mar 2012, 5:10 AM
You shouldn't use a renderer on a checkcolumn as it's using it and you would break the column.

If you want other columns checked then you need to update that field value in the record and the column should check based on that value change.

poojagarg89
11 Mar 2012, 9:02 PM
How I can update that record ? is there any method or event which I can use for updating record?

Ash2009
12 Mar 2012, 10:28 AM
How I can update that record ? is there any method or event which I can use for updating record?

you can use record.set('myCheckbox', true); //where myCheckbox is the field name given in store.

poojagarg89
12 Mar 2012, 9:06 PM
yup Issue resolved :)