Author Topic: maintain the user selection in case of the server-side filter and pagination.  (Read 346 times)

vijay@spinetechnologies

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 87
    • View Profile
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.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Please use dataModel.beforeSend callback instead of beforeFilter event and let me know the results.

vijay@spinetechnologies

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


Hii,

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

Thank you