1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    20
    Vote Rating
    0
    seda is on a distinguished road

      0  

    Default Deselect checkbox when row is clicked

    Deselect checkbox when row is clicked


    Is it possible to deselect checkbox (selModelConfig: {type: 'checkbox'}) when the row in the grid is clicked and checkbox is "checked"? The only way is to clicked on the small checkbox to deselect it.

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    91
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    It already does that if you hold down the ctrl-key.

    If you want it to do that, even without the ctrl key, then you should override the CheckboxSelectionModel.handleMouseDown method and replace e.ctrlKey with true.

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Posts
    20
    Vote Rating
    0
    seda is on a distinguished road

      0  

    Default Thanks, ...

    Thanks, ...


    Thank you Condor for info, CTRL + mouse click really do uncheck. I need the second solution. I tried to implement the "ctrlKey hack", but without success. Iny idea why?

    Here is the code, i tried lots of combinations, but without success:

    Code:
    Ext.override(Ext.grid.CheckboxSelectionModel, {
    
    handleMouseDown :  function (g, rowIndex, e) {
    
        e.ctrlKey = true;
    
        if (e.button !== 0 || this.isLocked()) {
            return;
        }
        var view = this.grid.getView();
        if (e.shiftKey && !this.singleSelect && this.last !== false) {
            var last = this.last;
            this.selectRange(last, rowIndex, e.ctrlKey);
            this.last = last;
            view.focusRow(rowIndex);
        } else {
            var isSelected = this.isSelected(rowIndex);
            if (e.ctrlKey && isSelected) {
                this.deselectRow(rowIndex);
            } else if (!isSelected || this.getCount() > 1) {
                this.selectRow(rowIndex, e.ctrlKey || e.shiftKey);
                view.focusRow(rowIndex);
            }
        }
    } // handleMouseDown function
            
    });

  4. #4
    Sencha User
    Join Date
    Feb 2013
    Posts
    9
    Vote Rating
    0
    jpurni is on a distinguished road

      0  

    Default Need help

    Need help


    Anyone got this working ?
    i tried over riding the mouse down event of selection model but nothing seems to work

  5. #5
    Sencha User
    Join Date
    Feb 2013
    Posts
    9
    Vote Rating
    0
    jpurni is on a distinguished road

      0  

    Default


    Hi Condor ,

    Can you please tell me how to get this done in EXTJS 4.1.3 .. the override doesnt seems to work..
    how to let deselecting of records without ctrl key
    Last edited by jpurni; 1 Jul 2013 at 5:05 AM. Reason: spell mistake

Similar Threads

  1. Replies: 1
    Last Post: 15 Sep 2009, 6:47 PM
  2. How i know when a Checkbox Selection model is a select or deselect?
    By vanderbill in forum Ext GWT: Help & Discussion (1.x)
    Replies: 3
    Last Post: 11 Feb 2009, 3:46 PM
  3. Selecting a row when checkbox is clicked
    By whoopywhale in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 6 Feb 2009, 12:56 AM

Thread Participants: 2