I am using the listview with a pager. When I refresh the listview with new data I want the page to go back to page 1 so I used the page() method. It doesn't work and the debugger shows the error message "pager.page is not a function".
Here is the code initializing the pager:
var pager; // this is global
pager = $("#pager").kendoPager({
dataSource: dataSource
});
And here's where I call the method:
pager.page(1);
I have no idea why this function isn't recognized and would appreciate some help.
5 Answers, 1 is accepted
Hi Glenn,
Generally speaking, the kendoPager function only initializes the Kendo Pager component. To assign the component object reference to the pager variable, continue the variable declaration by adding .data("kendoPager") to the kendoPager function as so:
pager = $("#pager").kendoPager({
dataSource: dataSource
}).data("kendoPager");
For a runnable example, check this Dojo: https://dojo.telerik.com/eyaToTim
Then all the component methods should work as expected. Please, give this a try, and let me know if you encounter any problems.
Regards,
George Gindev
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).
Hi Glenn,
I understand how frustrating it can be to find something without knowing what to search for. That is why we put the most important information in the Overview section of each component.
In your case, what you are searching for is titled Referencing Existing Instances, and you can check it out at https://docs.telerik.com/kendo-ui/controls/data-management/pager/overview#referencing-existing-instances
I am happy to consider any suggestions about how the documentation could be made any more clear and concise.
Regards,
George Gindev
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).
First of all, I don't know why you complicate things by making this necessary. I have worked with many jQuery plugins and have never seen one that requires the use of data() to obtain a reference. What is the rationale for this?
Second, as I mentioned I am using a listview with the pager, and found that the listview also has this requirement. But it isn't mentioned on the listview overview page. Is this a requirement for all the components? If so it should be on every overview page and also mentioned prominently in the general documentation.
Hello Glenn,
Using the .data() method is a high-level architectural decision that we have decided to follow.
Thank you for pointing out the missing piece of the documentation. I logged this in our internal issue tracking system.
Regards,
George Gindev
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.