Stop Pagination.

Hi, I want to stop a grid pagination when something condition has met. 
E.g
1. When the user has a changes on on the 1st page. And he/she wants to go to the next page, I want to prompt him/her that he needs to save first before paginating. So I want to stop the pagination. I'm thinking about this on actionBeging of grid, but I have no idea on how can I do it.

3 Replies

MF Mohammed Farook J Syncfusion Team October 4, 2018 09:32 AM UTC

Hi Robin,  
 
Thanks for contacting Syncfusion support. 
 
You can achieve your requirement by using the actionBegin event of Grid component and click event pager component. If you set the args.cancel property as true in both events then paging action will be canceled. We have prepared a simple sample based on your query. Please refer to the below code example, Documentation link and sample link.  
 
[index.js]  
. . . 
    var grid = new ej.grids.Grid({  
        dataSource: data,  
        allowPaging:true,  
        dataBound:Bound,  
        actionBegin:begin,  
        columns: [  
            .   .  .  
        ]  
    });  
    grid.appendTo('#Grid');  
function Bound(e){  
       var pager = document.getElementsByClassName('e-gridpager')[0].ej2_instances[0];  
       var old = pager.click;  
      pager.click = function (args) {  
          old.call(this, args);  
          // here you can add conditions  
         args.cancel = true;  // cancels the pager refresh   
    };  
 
function begin(e) {  
    if (e.requestType === 'paging') {  
      e.cancel = true; // cancels the grid paging  
    }  
  }  
 
 
Sample               : https://stackblitz.com/edit/mgfylc?file=index.ts  
 
Please get back to us if you have any further assistance on this.  
  
Regards,  
J Mohammed Farook 
 



RL Robin Leo Zapata Lamatao October 5, 2018 02:48 AM UTC

Thank you so much! :)



MF Mohammed Farook J Syncfusion Team October 5, 2018 04:43 AM UTC

Hi Robin,   
 
Thanks for your update.  
 
We are happy to hear that the provided solution has been resolved your problem. 
 
Please get back to us if you need further assistance.  
 
Regards, 
J Mohammed Farook 


Loader.
Up arrow icon