ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: vijay@spinetechnologies on May 03, 2022, 12:32:15 pm

Title: Want the state of selected records in server side pagination
Post by: vijay@spinetechnologies on May 03, 2022, 12:32:15 pm

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?
Title: Re: Want the state of selected records in server side pagination
Post by: paramvir on May 03, 2022, 05:09:53 pm
Please try filterModel.hideRows mode.

https://paramquery.com/pro/api#option-filterModel
Title: Re: Want the state of selected records in server side pagination
Post by: vijay@spinetechnologies 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
Title: Re: Want the state of selected records in server side pagination
Post by: paramvir 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};
})
});

});
},
Title: Re: Want the state of selected records in server side pagination
Post by: vijay@spinetechnologies on May 06, 2022, 04:37:57 pm
Dear Paramvir,

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