0

I do a search on my page and get a list of results. When I click in the grid and click ctrl + A, all the records in the grid should get selected. For this I am using the following code.

{ key: Ext.EventObject.A,
                ctrl: true,
                fn: Ext.bind(this.doSelectAll, this),
                defaultEventAction: "preventDefault"
           }


doSelectAll: function(keyCode, event) {
    var grid = this.view;
    event.preventDefault();
    grid.getSelectionModel().deselectAll(true);
    grid.getSelectionModel().selectAll(true);
    setTimeout(function() {            
        grid.getView().scrollBy(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,false);
    }, 0.0);  
    grid.getView().focusRow(0);
},

I don't have any issue with the select all functionality. But when I click ctrl + A and all the records get selected, If I try to click on one of those selected records, its taking huge time to deselect all the records and select the one particular record that I click. Like say If I have 20 records in my grid, If I say ctrl + A in the grid, all the 20 records get selected. Now if I click on one particular record, say the first record in the grid, it takes 1-2 seconds to deselect all the records and select the first record. If I have 100 records, its almost taking 8-10 seconds to deselect and select process. The maximum records I can show in my grid is 300 and to deselect and select one particular record, its taking almost 15-18 seconds. If I try to click somewhere in the grid during this process, I am getting script error and it asks me whether to stop the script or continue. This is happening in Firefox and IE as well. Not sure If I am doing something wrong or am I missing something. Any ideas?...

user3546785
  • 157
  • 1
  • 7
  • 16
  • do you have custom code on deselect / select? – Amol Katdare Sep 24 '14 at 23:09
  • I have a custom code for the select all functionality which I pasted in the above post. But I don't have anything custom for the deselect part. – user3546785 Sep 25 '14 at 04:25
  • I don't have time to investigate at the moment, but somewhere in the back of my mind i'm wondering if the records are being deselected one-at-a-time and the grid is re-rendering after each deselect. Maybe try suspending and resuming rendering at the start and end of the function. Also take a look at the default select function being used by the view and see if you could possibly optimize it. – DoubleDouble Sep 25 '14 at 21:26

0 Answers0