PDA

View Full Version : how to check Ext.ux.CheckColumn programatiaclly



atul.sachan@capgemini.com
4 Jun 2012, 4:40 AM
I am using 'Ext.ux.CheckColumn' component in our Grid. Is there any way to check this column programmatically after loading the data.
Thanks.

papaja
4 Jun 2012, 10:44 AM
I believe there is a way to do it. I would say right path to follow would be to programatically update data/record in the store and grid will update automatically.

scottmartin
4 Jun 2012, 2:31 PM
This example should allow you check rows as needed:



// mark checkboxes
if (json.data.length){
for (var i = 0; i < json.data.length; i++){
var rec = this.gridC.store.getById(json.data[i].id); // json.data[i].getId()
if (rec.data.field_type == 's'){
this.gridC.getSelectionModel().select(rec,true,false);
}
}
}


Regards,
Scott.

atul.sachan@capgemini.com
5 Jun 2012, 3:30 AM
This example should allow you check rows as needed:



// mark checkboxes
if (json.data.length){
for (var i = 0; i < json.data.length; i++){
var rec = this.gridC.store.getById(json.data[i].id); // json.data[i].getId()
if (rec.data.field_type == 's'){
this.gridC.getSelectionModel().select(rec,true,false);
}
}
}


Regards,
Scott.

Still it is not working, i have two checkboxes in my grid.


my code is here:



xtype : 'gridpanel',

store :
'PriColor',


//width : 390,

width : 383,


//overflowY:'scroll',

height:240,

border :
false,

cls:
'x-grid-body_1',



id :
'priColorGridPanel',

selModel: {selType:
'rowmodel' },

columns: [

{

xtype :
'checkcolumn',

width : 30,

sortable :
false,

menuDisabled :
true,

draggable :
false,

resizable :
false,

id :
'check1',

cls :
'Want',

dataIndex :
'want',

editor:

{

xtype:
'checkbox',

cls:
'x-grid-checkheader-editor'

},

listeners :

{

checkchange :
function(column, recordIndex, checked)

{}

}

},{

xtype :
'checkcolumn',

width : 30,

sortable :
false,

id :
'check2',

cls :
'Dont_Want',

menuDisabled :
true,

resizable :
false,

draggable :
false,

dataIndex :
'dwant',

listeners :

{

checkchange :
function(column, recordIndex, checked)

{}

}

},{

xtype:
'gridcolumn',

header :
'',

menuDisabled :
true,

draggable :
false,

resizable :
false,

width : 305,

tdCls:
'ColumnWidth1',

sortable :
false,

dataIndex:
'label'

}

]