Author Topic: Want the state of selected records in server side pagination  (Read 542 times)

vijay@spinetechnologies

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 87
    • View Profile

Hi,

We have implemented the PQ grid with the serverside pagination with a server-side filter. In the grid, we provide the checkbox column the select the records.
Now when we filter records and select the filter records, and then remove the filter, then the grid removes the selection. Is it any way to maintain the selection?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Want the state of selected records in server side pagination
« Reply #1 on: May 03, 2022, 05:09:53 pm »
Please try filterModel.hideRows mode.

https://paramquery.com/pro/api#option-filterModel

vijay@spinetechnologies

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 87
    • View Profile
Re: Want the state of selected records in server side pagination
« Reply #2 on: May 03, 2022, 07:59:58 pm »
We have implemented a server-side filter

When we try to filter the data from the search box, it postback on the event of focus out

due to which it fails to maintain the state of the grid.

the given solution hideRows option doesn’t work.

Kindly assist us on the same

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Want the state of selected records in server side pagination
« Reply #3 on: May 04, 2022, 11:47:08 am »
Please add a unique field in the rows in your grid and use this code after replacing customerid by unique field name:

Code: [Select]
beforeFilter: function(){
var grid = this,
selected = grid.SelectRow().getSelection().map(function(obj){
return obj.rowData.customerid;
});
this.one('complete', function(){

grid.SelectRow().add({
rows: grid.getData().filter(function(rd){
return selected.indexOf( rd.customerid ) >= 0 ;
}).map(function(rd){
return {rowIndx: rd.pq_ri};
})
});

});
},
« Last Edit: May 04, 2022, 11:50:52 am by paramvir »

vijay@spinetechnologies

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 87
    • View Profile
Re: Want the state of selected records in server side pagination
« Reply #4 on: May 06, 2022, 04:37:57 pm »
Dear Paramvir,

Thanks for your solution. It resolved my query.  :) :) :)