Pagination related

Any event for get and set pageNumber in ejs-pager provided by you.


1 Reply

PS Pavithra Subramaniyam Syncfusion Team May 22, 2018 01:26 PM UTC

Hi Surinder, 

You can get the currentPage number from the actionComplete event of Grid Component with requestType ‘paging’. You can set the currentPage in two ways. One is using grid.pageSettings.currentPage and the other one is setting the pagerObj.currentPage. Please refer to the below code example documentation link and sample link. 

[component.ts] 
@Component({ 
    selector: 'app-container', 
    template: ` <button ej-button class='e-flat' (click)='click()'>Change page</button> 
<ejs-grid #grid [dataSource]='data' (actionComplete)='actionComplete($event)' [allowPaging]='true' height='268px'> 
               .   .   . 
                </ejs-grid>` 
}) 
export class AppComponent implements OnInit { 
   ngOnInit(): void { 
        this.data = orderData; 
        this.pageSettings={currentPage:2,pageSize:10};   // using grid.pageSettings property 
    } 

    actionComplete(e:PageEventArgs){ 
      if(e.requestType == 'paging'){ 
        console.log(e); 
      } 
    } 

click(): void { 
       // using Pager Object 
       let pagerObj = this.grid.element.querySelector('.e-pager.e-control').ej2_instances[0]; 
       pagerObj.currentPage=4; 
       pagerObj.refresh(); 
    } 


Sample               : https://plnkr.co/edit/3vQk7DGkQLt8XrYTd6ye?p=preview  

Regards, 
Pavithra S. 


Loader.
Up arrow icon