This is a migrated thread and some comments may be shown as answers.

Add element to grids pager

1 Answer 535 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Seyfor
Top achievements
Rank 1
Seyfor asked on 05 Oct 2016, 11:47 AM

How can I properly add element to grids pager? I want to add some additional label, buttons ...

I tried with:

this.grid.wrapper.find('.k-pager-wrap.k-grid-pager').prepend("<div>test</div>")

and it works, but problem is, that every time setOptions is called, pager is destroyed and recreated. So I detach my div before calling setOptions and after that prepend it again:

this.footer.detach();
this.grid.setOptions(gridOptions);
this.getKendoPagerWrapper().prepend(this.footer);

but the problem is that also resize destroy pager (I have grid in PageControl in Window). When user resize/maximize/restore/minimize window grid.resize is called which destroy pager and all events, on custom element (this.footer) added to grids pager, are gone.

1 Answer, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 07 Oct 2016, 06:00 AM

Hello Matjaž,

In order to achieve this you could use the dataBound event of the Grid widget, similar to the following:

 

dataBound: function() {
  var pagerElement = this.pager.element;
  if (!pagerElement.find(".myCustomElement").length) {
    pagerElement
        .prepend('<div class="myCustomElement">test</div>');
  }
}

 

Regards,
Rosen
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Grid
Asked by
Seyfor
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or