Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-9268 in a recent build.
  1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    4
    Vote Rating
    0
    mongolores is on a distinguished road

      0  

    Default Ext.grid.Panel allowDeselect config has no effect

    Ext.grid.Panel allowDeselect config has no effect


    REQUIRED INFORMATIONExt version tested:
    • Ext 4.2.0 rev 663
    Browser versions tested against:
    • FF18 (firebug 1.9.2 installed)
    • IE10
    • Google Chrome 25
    Description:
    • Ext.grid.Panel allowDeselect config does not apply to appropriate config of Ext.selection.Model.
    Steps to reproduce the problem:
    • Create the simplest Ext.grid.Panel with allowDeselect: true config and some rows of data.
    The result that was expected:
    • The selected row should be deselected after mouse clicking on it.
    The result that occurs instead:
    • The selected row can not be deselected back.
    Test Case:
    Code:
     
    Ext.onReady(function() {    
        var myData = [
            [1, 'Company 1'],
            [2, 'Company 2'],
            [3, 'Company 3']
        ];
        
        Ext.define('Company', {
            extend: 'Ext.data.Model',
            fields: [
                {name: 'id', type: 'int'},
                {name: 'name', type: 'string'}
            ],
            idProperty: 'id'
        });
        
        var gridStore = Ext.create('Ext.data.ArrayStore', {
            data: myData,
            model: 'Company'
        });
        
        var MyGrid = Ext.create('Ext.grid.Panel', {
            allowDeselect: true,
            // selModel: Ext.selection.Model({mode: 'single', allowDeselect: true}),    // this way works!
            store: gridStore,
            renderTo: Ext.getBody(),
            columns: [
                {text: '№', dataIndex: 'id'},
                {text: 'Company name', dataIndex: 'name', flex: 1 }
            ]
        });    
    });

    Possible fix:
    • if we create a grid with default selection model then this model will be created with allowDeselect config with default value 'false' (see Ext.Selection.Model class). That is why the following code in getSelectionModel function of parent to grid Ext.Panel.Table class does not work:
      Code:
              Ext.applyIf(selModel, {
                  allowDeselect: me.allowDeselect
              });
      As you can see the applyIf function will never work and seems to be replaced with Ext.apply function:
      Code:
              Ext.apply(selModel, {
                  allowDeselect: me.allowDeselect
              });
    Additional CSS used:
    • only default ext-all.css
    Operating System:
    • Win7x64

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,824
    Vote Rating
    836
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

Thread Participants: 1

Tags for this Thread