Hybrid View

  1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    13
    Vote Rating
    0
    summer980824 is on a distinguished road

      0  

    Default 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
                }

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,197
    Vote Rating
    482
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You could just create override to disable the action:

    Code:
    Ext.override(Ext.ux.CheckColumn, {
        processEvent: Ext.emptyFn // do nothing
    });
    This is a simplified version, you could copy the entire function and replace with your code.

    Scott.

  3. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,197
    Vote Rating
    482
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    err, The previous leaves a dirty marker .. here is a better approach:

    Code:
    header: 'Check',
    xtype: 'checkcolumn',
    dataIndex: 'check',
    editor: {
    disabled: true,
    	xtype: 'checkbox'
    },
    listeners: {
    	beforecheckchange: function(){
    		return false; // disable check
    	}
    }
    Scott.

  4. #4
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    13
    Vote Rating
    0
    summer980824 is on a distinguished road

      0  

    Default


    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.

  5. #5
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    144
    Vote Rating
    1
    anitacynax is on a distinguished road

      0  

    Default 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.

  6. #6
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    144
    Vote Rating
    1
    anitacynax is on a distinguished road

      0  

    Default


    Quote Originally Posted by scottmartin View Post
    err, The previous leaves a dirty marker .. here is a better approach:

    Code:
    header: 'Check',
    xtype: 'checkcolumn',
    dataIndex: 'check',
    editor: {
    disabled: true,
        xtype: 'checkbox'
    },
    listeners: {
        beforecheckchange: function(){
            return false; // disable check
        }
    }
    Scott.
    In this case 'return false' in the beforecheckchange function disables ALL the checkboxes in the checkcolumn. What do you do however if you want to enable only ONE checkbox in the checkcolumn (i.e. disable all but one checkbox in the checkcolumn)?

  7. #7
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,197
    Vote Rating
    482
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Is there a condition that you can set based on the params?

    Code:
    beforecheckchange: function(column, row, checked, opts){ 
        if (..) { return false; } 
    }
    Scott

  8. #8
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    144
    Vote Rating
    1
    anitacynax is on a distinguished road

      0  

    Default


    Thanks for the reply, Scott. I solved this issue in another way. Thanks though.

  9. #9
    Sencha Premium Member
    Join Date
    Mar 2013
    Posts
    4
    Vote Rating
    0
    sagheer is on a distinguished road

      0  

    Default


    Quote Originally Posted by scottmartin View Post
    err, The previous leaves a dirty marker .. here is a better approach:

    Code:
    header: 'Check',
    xtype: 'checkcolumn',
    dataIndex: 'check',
    editor: {
    disabled: true,
        xtype: 'checkbox'
    },
    listeners: {
        beforecheckchange: function(){
            return false; // disable check
        }
    }
    Scott.
    Hi Scott,

    I am using the same approach for disabling the checkboxes in checkcolumn and it works fine. How can I apply style to the disabled checkboxes so that they appear as disabled. In other words, this approach displays the checkcolumn as normal checkboxes but they don't appear as disabled (like normally checkboxes are on getting disabled e.g. gray colored). Any ideas in that regard.

  10. #10
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    51
    Vote Rating
    1
    stahlman is on a distinguished road

      0  

    Default


    Quote Originally Posted by sagheer View Post
    Hi Scott,

    I am using the same approach for disabling the checkboxes in checkcolumn and it works fine. How can I apply style to the disabled checkboxes so that they appear as disabled. In other words, this approach displays the checkcolumn as normal checkboxes but they don't appear as disabled (like normally checkboxes are on getting disabled e.g. gray colored). Any ideas in that regard.
    Yes. This would be nice. I'm currently setting...
    Code:
    metaData.tdCls = 'x-item-disabled'
    within the renderer function when I want a checkbox to appear disabled. What I'd really like, however, is an easy way to access the underlying Checkbox component in an arbitrary cell of the grid; this would permit me to invoke (eg) the component's disable() method directly, which seems a bit cleaner and more robust...