Author Topic: select all rows in current view  (Read 6095 times)

motoguru

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 35
    • View Profile
select all rows in current view
« on: January 22, 2014, 12:05:22 am »
And I did like You said before, no result, but really don't worry :) It's solved another way.

By the way, is there any way to select all rows in current view (after applying filters)?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: select all rows in current view
« Reply #1 on: January 22, 2014, 12:43:44 am »
Selection method needs rowIndx or rowIndxPage as one of the parameters.

http://paramquery.com/pro/api#method-selection

If all the rows need to be selected, rowIndx range is from 0 to dataModel.data.length

If all the rows on current page need to be selected, rowIndxPage range is from 0 to pageModel.rPP


motoguru

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: select all rows in current view
« Reply #2 on: January 22, 2014, 01:23:38 am »
If all the rows need to be selected, rowIndx range is from 0 to dataModel.data.length
If all the rows on current page need to be selected, rowIndxPage range is from 0 to pageModel.rPP


Yes and it's pretty obvious, but what about the situation which we need to select all rows filtered locally by one column's header? My start dataModel.data.length is unchanged and the algorhitm tryes select rows which are not supposed to be selected (hidden). Plus I have about 250k rows loaded locally (before header filtering) from browser's local storage and setting range 0...dataModel.data.length to $("#gridContainer").pqGrid("setSelection", { rowIndx: range}); hangs the browser and crashes it (for example range for 3, 5 or 20 rows works fine).

How to "Select all rows" on all pages when we have filtered (header filtering - local) data and many pages?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: select all rows in current view
« Reply #3 on: January 22, 2014, 04:42:44 pm »
Looks like you have 2 concerns:

1) The filtered out data should not be selected.

Solution: dataModel.data doesn't include the filtered out rows, so there is no problem in using dataModel.data

2) How to select all rows on all pages with hundreds of thousand of rows from performance point of view.

Solution: selection method is designed for selection of few rows, hence not suitable in your case. You need to use pq_rowselect property of every rowData in order to select rows en masse.

Code: [Select]
var data = dataModel.data;
for(var i=0, len=data.length; i<len;i++){
  var rowData=data[i];
  rowData.pq_rowselect = true;
}
//refresh after the loop
$grid.pqGrid( 'refresh' );

Please let know whether it answers all your concerns or have I missed something..
« Last Edit: January 22, 2014, 04:46:20 pm by paramquery »

motoguru

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: select all rows in current view
« Reply #4 on: February 18, 2014, 01:43:02 am »
Yes, it works just fine (2nd case) :)

Thank You.

« Last Edit: February 18, 2014, 02:30:02 am by motoguru »