Results 1 to 3 of 3

Thread: CheckboxModel deselection difference

  1. #1
    Sencha User
    Join Date
    May 2012
    Location
    Ukraine
    Posts
    23
    Answers
    2
    Vote Rating
    0
      0  

    Default Answered: CheckboxModel deselection difference

    Hello,
    I have a grid with Ext.selection.CheckboxModel.
    Code:
    Ext.define('MyGrid',
    {
        extend: 'Ext.grid.Panel',
        store: Ext.create('MyStore'),
        columns: [{
            header: 'Code',
            dataIndex: 'Code'
        },{
            header: 'Name',
            dataIndex: 'Name'
        }],
        initComponent: function(){
            this.selModel = Ext.create("Ext.selection.CheckboxModel",{
                    checkOnly : true,
                    listeners: {
                        select: function(row, record, index, eOpts){
                            myBusinessService.select(record);
                        },
                        deselect: function(row, record, index, eOpts){
                            myBusinessService.deselect(record);
                        }
                    }
                });
            this.callParent(arguments);
        }
    });
    I have to make some actions when user selects or deselects some record in this grid. In some cases the store for this grid is reloading. In ExtJS 4.1.1 before store is loaded there happens deselection of all selected item that makes deselect event for Checkboxmodel fired. But I just want to process user selection\deselection. How can I distinguish deselection via store reloading and user deselection? Thanks!

  2. I found the solution. In order to prevent deselecting all selected rows in grid with CheckboxModel when store is reloading, before store loading there should be done store.removeAll(). After this you can use store.load(). Deselect event isn't fired.

  3. #2
    Sencha User metalinspired's Avatar
    Join Date
    Apr 2012
    Posts
    98
    Answers
    4
    Vote Rating
    4
      0  

    Default

    I couldn't quite figure out what are you saying but pruneRemoved might be of some help maybe.

  4. #3
    Sencha User
    Join Date
    May 2012
    Location
    Ukraine
    Posts
    23
    Answers
    2
    Vote Rating
    0
      0  

    Default store.removeAll()

    I found the solution. In order to prevent deselecting all selected rows in grid with CheckboxModel when store is reloading, before store loading there should be done store.removeAll(). After this you can use store.load(). Deselect event isn't fired.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •