View Full Version : CheckColum - save row on (un)checking the checkbox

23 Feb 2011, 6:54 AM

Just wandering if this is the correct solution to save a Grid row when a CheckColum is clicked. Are there any other ways to do this?

var cb = new Ext.ux.grid.CheckColumn({
header: _('survey.active')
,dataIndex: 'active'
,width: 40
,sortable: true
,onMouseDown: function(e, t){

var rowData = "";//holds the data to be sent
if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){
var index = this.grid.getView().findRowIndex(t);
var record = this.grid.store.getAt(index);
record.set(this.dataIndex, !record.data[this.dataIndex]);
rowData = record.data;//save row records. will be used in the ajax request

!!!seems that this is triggered by a row click and checkbox click
don't send the ajax request if the rowData is empty. rowData is empty if the row is clicked.
//send ajax request to update the data
url : Survey.config.connectorUrl ,
params : { action : 'mgr/survey/updateFromGrid', data: Ext.util.JSON.encode(rowData)},
method: 'POST',
success: function ( result, request ) {
//Ext.MessageBox.alert('Success', 'Data return from the server: '+ result.responseText);
failure: function ( result, request) {
//Ext.MessageBox.alert('Failed', result.responseText);

Thank you

23 Feb 2011, 2:59 PM

Another solution is to somehow trigger the save_action: 'myAction' in the Grid.
Any ideas on how I can target the grid.

Here's the code

id: 'survey-grid-survey'
,url: Survey.config.connectorUrl
,baseParams: { action: 'mgr/survey/getList' }
,fields: ['id','name','description','active','menu']
,paging: true
,remoteSort: true
,anchor: '95%'
,autoExpandColumn: 'name'
,save_action: 'mgr/survey/updateFromGrid'
,autosave: true
,plugins: [cb]
,columns: [{
header: _('id')
,dataIndex: 'id'
,sortable: true
,width: 60
header: _('survey.name')
,dataIndex: 'name'
,sortable: true
,width: 100
,editor: { xtype: 'textfield' }
header: _('survey.description')
,dataIndex: 'description'
,sortable: false
,width: 350
,editor: { xtype: 'textfield' }
}, cb]
xtype: 'textfield'
,id: 'survey-search-filter'
,emptyText: _('survey.search...')
,listeners: {
'change': {fn:this.search,scope:this}
,'render': {fn: function(cmp) {
new Ext.KeyMap(cmp.getEl(), {
key: Ext.EventObject.ENTER
,fn: function() {
return true;
,scope: cmp

text: _('survey.survey_create')
,handler: { xtype: 'survey-window-survey-create' ,blankValues: true }

Thank you

24 Feb 2011, 7:37 AM
Instead of overriding CheckColumn, I would listen for the store 'update' event and check if the 'active' field was changed to false.

10 Mar 2011, 11:52 PM
I replaced BooleanColumn created by Ext Designer with CheckColumn at runtime. See


but i can not catch any event from CheckColumn. Even store's 'update' doesn't fire on CheckColumn change. (?!)

24 Sep 2013, 4:08 PM
working on the checkcolumn having few cells rendered with '' empty and few having checkboxes, in this scenario how to avoid the click events on the empty cells

26 Sep 2013, 7:59 AM
I've not used the checkColumn plugin before - but I would imagine you must be able to interrogate the event object during cell click to detect what the target was? If the target isn't a checkbox, then don't run the selected code.