-
27 Jun 2012 12:32 AM #1
Unable to disable the checkboxes in the check columns
Unable to disable the checkboxes in the check columns
Hi,
I am trying to disable the check boxes when using Ext.ux.CheckColumn. When I set disabled is true in the configuration, it doesn't seem to work, as I can still change the check boxes in the column.
Code:{ xtype: 'checkcolumn', header: 'Create', dataIndex: 'create', menuDisabled: true, disabled: true }
-
28 Jun 2012 2:54 PM #2
You could just create override to disable the action:
This is a simplified version, you could copy the entire function and replace with your code.Code:Ext.override(Ext.ux.CheckColumn, { processEvent: Ext.emptyFn // do nothing });
Scott.
-
28 Jun 2012 3:00 PM #3
err, The previous leaves a dirty marker .. here is a better approach:
Scott.Code:header: 'Check', xtype: 'checkcolumn', dataIndex: 'check', editor: { disabled: true, xtype: 'checkbox' }, listeners: { beforecheckchange: function(){ return false; // disable check } }
-
28 Jun 2012 6:56 PM #4
Brilliant solution! Thanks for your help

But I think adding the listener is enough to disable the checkbox, it's no need to configure the editor.
-
12 Nov 2012 2:02 AM #5
difference between checkchange and beforecheckchange
difference between checkchange and beforecheckchange
What is the difference between checkchange and beforecheckchange? I am currently using checkchange but do not understand the difference between the two. Thanks.
-
15 Nov 2012 4:35 AM #6
-
18 Nov 2012 3:09 PM #7
Is there a condition that you can set based on the params?
ScottCode:beforecheckchange: function(column, row, checked, opts){ if (..) { return false; } }
-
19 Nov 2012 4:18 AM #8
Thanks for the reply, Scott. I solved this issue in another way. Thanks though.
-
19 Nov 2012 7:57 AM #9
It would be helpful for others if you would post your solution

Scott.
-
20 Nov 2012 12:14 AM #10
solution: use checkchange
solution: use checkchange
I used checkchange and the following line of code in checkchange:
for (var i =0; i < teststore.getCount(); i++) {teststore.getAt(i).set(this.dataIndex, false); record.set(this.dataIndex, true);}
Here is the code for the grid and the checkcolumns:
Code:var grid = Ext.create('Ext.grid.Panel', { id: 'animalGrid', title: '', store: teststore, plugins: ['headertooltip'], columns: [ { text: 'Name', dataIndex: 'Name', width: 120}, { text: 'Role', dataIndex: 'Type', width: 125}, { text: 'Mammal', dataIndex: 'Mammal', xtype: 'checkcolumn', listeners: {'checkchange' : function(column, recordIndex, checked) {var record = teststore.getAt(recordIndex); record.set('Amphibian', false); record.set('Bird', false); for (var i =0; i < teststore.getCount(); i++) {teststore.getAt(i).set(this.dataIndex, false); record.set(this.dataIndex, true);} }},width: 68, tooltip: '<b>Mammal Description:</b> '}, { text: 'Amphibian', dataIndex: 'Amphibian', xtype: 'checkcolumn', listeners: {'checkchange' : function(column, recordIndex, checked) {var record = teststore.getAt(recordIndex); record.set('Mammal', false); record.set('Bird', false); }},width: 68, tooltip: '<b>Amphibian Description:</b> '}, { text: 'Bird', dataIndex: 'Bird', xtype: 'checkcolumn', listeners: {'checkchange' : function(column, recordIndex, checked) {var record = teststore.getAt(recordIndex); record.set('Mammal', false); record.set('Amphibian', false); }},width: 68, tooltip: '<b>Bird Description:</b>'} ]Last edited by anitacynax; 16 May 2013 at 7:02 AM. Reason: code edit


Reply With Quote
