How to add extra items to the default paging bar

Hi,

I'd like to know how to add extra items to the default paging bar. For instance, I need to add a refresh button next to the paginator count.

Is there any way to do this more or less like on the picture?

Paging.PNG


Regards


3 Replies

RS Rajapandiyan Settu Syncfusion Team August 9, 2021 01:34 PM UTC

Hi Kamil, 
  
Thanks for contacting Syncfusion support. 

Based on your query, you want to render some customer element inside the Grid pager. You can achieve your requirement by using the dataBound event of Grid. In that event, we created the button elements in javascript way and appended it to the Grid pager element. Find the below cod example and sample for more information. 



[app.component.html] 

 
    <ejs-grid #grid [dataSource]='data' [allowPaging]="true" [pageSettings]="pageSettings" height='350' 
        (dataBound)="dataBound($event)"> 
        ---- 
    </ejs-grid> 
 

[app.component.ts] 

 
export class AppComponent { 
  @ViewChild('grid', { static: true }) 
  public gridGridComponent; 
  ---- 
 
  dataBound(args) { 
    if (!this.grid.element.querySelector('.custompageelm')) { 
     // create the custom element 
      var custompageelm = document.createElement('div'); 
      custompageelm.classList.add('custompageelm'); 
      var button1 = document.createElement('button'); 
      button1.innerText = 'Button1'; 
      button1.addEventListener('click'this.btn1Click.bind(this)); 
      var button2 = document.createElement('button'); 
      button2.innerText = 'Button2'; 
      button2.addEventListener('click'this.btn2Click.bind(this)); 
      custompageelm.appendChild(button1); 
      custompageelm.appendChild(button2); 
      // append the custom element into the grid pager  
      this.grid.element.querySelector('.e-gridpager').appendChild(custompageelm); 
    } 
  } 
 
  btn1Click(args) { 
    alert('do your operation for button1'); 
  } 
  btn2Click(args) { 
    alert('do your operation for button2'); 
  } 
} 
 

[app.component.css] 

 
.e-grid .e-gridpager div.custompageelm { 
  displayinline-block; 
  margin0 0 8px 12px; 
  overflowhidden; 
} 
 
.e-grid .e-gridpager div.custompageelm button { 
  displayinline-block; 
  margin0 5px; 
} 
 



Please get back to us if you need further assistance with this. 
  
Regards,  
Rajapandiyan S 



KK Kamil Krzyzanski August 13, 2021 10:12 AM UTC

Thank you for help. It works.


Regards,

Kamil



RS Rajapandiyan Settu Syncfusion Team August 13, 2021 01:07 PM UTC

Hi Kamil, 
  
We are glad that the provided solution resolved your requirement. 
 
Please get back to us if you need further assistance. 
  
Regards,  
Rajapandiyan S 


Loader.
Up arrow icon