-
3 Jan 2009 11:07 AM #1
Checkbox enable/disable
Checkbox enable/disable
I have Combobox and Checkbox in the grid.
How can I disable / enable Checkbox based on the values selected in combobox?
For example, Combobox value has the following values {1,2,3,4}
If combobox value is 1 or 3 then checkbox should be disabled.
Thanks in advance
-
3 Jan 2009 12:44 PM #2
-
3 Jan 2009 1:13 PM #3Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
No, that is not the proper method.
Normally you implement the isCellEditable method of the ColumnModel and return false for the checkbox field if the combobox field contains a value 1 or 3.
Unfortunately CheckboxColumn doesn't check isCellEditable (it's a bug, you can probably find a fix somewhere on this forum...).
-
5 Jan 2009 7:01 AM #4
Check box problem
Check box problem
When I use isCelleditable it is making read only entire row not a particualr cell
Is there any way to hide particular check boxes in grid?
-
5 Jan 2009 7:11 AM #5Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
You wrote the isCellEditable method wrong if the whole row becomes uneditable!
ps. Are you using a CheckboxSelectionModel or a CheckColumn?
-
5 Jan 2009 7:17 AM #6
Check box problem
Check box problem
Thanks Condor,
I am using "CheckboxSelectionModel "
------------------------------------------------------
------------------------------------------------------
var checkboxEditor = {
header: 'Test',
dataIndex: 'testbox',
renderer: function(v) {
return '<div class="x-grid3-check-col'+(v?'-on':'')+'">*</div>';
},
editor: new Ext.grid.GridEditor(new Ext.form.Checkbox(), {
cls: 'x-small-editor x-grid-editor grid-checkbox-editor'
})
}
--------------------------------------------------------
---------------------------------------------------------
-
5 Jan 2009 7:22 AM #7Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Which is it? Are you using a CheckboxSelectionModel or the checkboxEditor column config you supplied?
You can fix the second one with:
(remove space between & and #160Code:var checkboxEditor = { header: 'Test', dataIndex: 'testbox', renderer: function(v, meta, r, row, col) { if(!colModel.isCellEditable(col, row)){ return '& #160;'; } return '<div class="x-grid3-check-col'+(v?'-on':'')+'">*</div>'; }, editor: new Ext.grid.GridEditor(new Ext.form.Checkbox(), { cls: 'x-small-editor x-grid-editor grid-checkbox-editor' }) }
-
5 Jan 2009 7:43 AM #8
Check box problem
Check box problem
I am using checkboxEditor column.
"Colindex 12" is my checkboxEditor column
--------------------------------------------------
isCellEditable : function(colIndex, rowIndex)
{
if (combobox1.getvalue() = 1))
{this.config[12].editable = true;}
else
{this.config[12].editable = false;}
return (this.config[12].editable )
-------------------------------------------------------------------------
Could you advise on that?
Tnx for your quick reply
-
5 Jan 2009 7:55 AM #9Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
That is not the way to use isCellEditable.
Try:
Code:isCellEditable: function(colIndex, rowIndex){ var dataIndex = this.getDataIndex(colIndex); if(dataIndex == 'testbox'){ var r = store.getAt(rowIndex); return r.get('dataIndex-of-column-with-combobox') == 1; } return this.constructor.prototype.isCellEditable.apply(this, arguments); }
-
5 Jan 2009 8:58 AM #10
Check column
Check column
Hi Condor, It is not working. Should I use checkcolumn instead?
I have 2 coumns in the grid.
The first columns is COMBObox column called CB1
The second one is checkbox Editor column.
CB1 contains the following value. ('Rec1','Rec2','Rec3','Rec4')
If CB1='Rec1' or CB1='Rec2' ,then checkbox editor column should be invisible.
Otherwise checkbox editor column should be visible.
Could you advise?


Reply With Quote