PDA

View Full Version : How to enable/disable checkbox in a grid using renderer



varmaj80
14 Oct 2014, 1:13 PM
I need to load a grid based on the query results I get. I am not having any issues with loading the text fields in the grid but there is one particular column which is a check box type. I am using the xtype: 'checkcolumn' for this purpose. The object that returns the query results returns a "Y" or "N" for this particluar column. If it is "Y", I need to enable the checkbox and if it is "N", the checkbox should be disabled. I am using the following code for defining my checkbox field.
{
xtype: 'checkcolumn',
header: "Old User",
disabled: true,
disabledCls:'x-item-enabled',
width: 170,
dataIndex: 'oldUser',
itemId: 'oldUser',
renderer: this.checkOldUser
}

checkOldUser: function (oldUser) {
if(oldUser== 'Y') {
this.oldUser.setDisabled(false);
}
}
This renderer function is not working for me. How should the renderer look like?. Can you please let me know how to resolve this issue?. Thanks....

scottmartin
14 Oct 2014, 8:29 PM
Check the code in this SO post: (code in answered post)
http://stackoverflow.com/questions/16975387/extjs-grid-disable-some-checkbox-on-special-row