change kendoPager pageSizes dynamically

1 Answer 23 Views
ListView Pager
Isabelle
Top achievements
Rank 1
Isabelle asked on 23 Jan 2024, 05:00 PM

  Hi

I'm using a kendoListView and a kendoPager like this :

$("#pagerLstArticle").kendoPager({
        dataSource: articles,
        pageSizes: [12, 24, 36, 48],
        messages: {
            display: "Articles {0} à {1} sur {2}"
        },
    });

I would like to adap the  kendoPager pageSizes depending on differents panels displayed or not on the screen

I can manage the kendoListView page size easily but for the kendoPager I don't know

How can I do this ?

Thank you

Isabelle

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 26 Jan 2024, 09:38 AM

Hello, Isabelle,

I can see that my colleague has answered the question in the support thread you opened, but I will copy her answer in case someone else has the same question:

Please note that the Kendo LitsView provides a built-in pager that can be enabled through the pageable configuration option:

https://docs.telerik.com/kendo-ui/api/javascript/ui/listview/configuration/pageable

Regarding changing the pagesizes in the pager component at runtime, you will need to destroy and recreate the component with the new pagesizes:

  $("#pager").data('kendoPager').destroy()
        $("#pager").empty()
        $("#pager").kendoPager({
          dataSource: dataSource,
          pageSizes: [5, 10, 15, 30],
          messages: {
                display: "Articles {0} à {1} sur {2}"
          },
});

Here is a Dojo example where this is demonstrated.

Regards,
Martin
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
ListView Pager
Asked by
Isabelle
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or