ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: vijay@spinetechnologies on November 07, 2022, 10:35:52 am

Title: maintain the user selection in case of the server-side filter and pagination.
Post by: vijay@spinetechnologies on November 07, 2022, 10:35:52 am
Dear,

We have implemented the server-side pagination on the pqGrid.

We are facing some issues while filtering the data.

Suppose the user chooses one row and filters the grid, due to the server-side functionality, the grid is refreshed and after the removal of the filter, the selection is removed.

We have applied the following code. It perfectly works in the case of the first filter, but if the user filters the data twice or more the selection is removed.

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};
         })
      });
      
   });
},

Kindly check and provide the solution/way to solve this.
Title: Re: maintain the user selection in case of the server-side filter and pagination.
Post by: paramvir on November 09, 2022, 06:20:39 am
Please use dataModel.beforeSend callback instead of beforeFilter event and let me know the results.
Title: Re: maintain the user selection in case of the server-side filter and pagination.
Post by: vijay@spinetechnologies on November 09, 2022, 02:47:15 pm


Hii,

Thanks for your reply. I build logic with the help of dataModel.beforeSend, and it perfectly works for me.

Thank you