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

page method not working

5 Answers 80 Views
Pager
This is a migrated thread and some comments may be shown as answers.
Glenn
Top achievements
Rank 1
Veteran
Glenn asked on 15 Oct 2020, 02:14 AM

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

Sort by
0
George Gindev
Telerik team
answered on 15 Oct 2020, 12:38 PM

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).

0
Glenn
Top achievements
Rank 1
Veteran
answered on 15 Oct 2020, 05:55 PM
I did discover this after asking the question, by looking at the sample code again. But this crucial bit of code isn't explained anywhere in the documentation that I can see. It should be explained somewhere that if you want to use any of the widget's methods that you have to include this code. I find it very frustrating when important and completely non-obvious information like this is buried in sample code instead of being clearly explained.

0
George Gindev
Telerik team
answered on 19 Oct 2020, 01:35 PM

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).

0
Glenn
Top achievements
Rank 1
Veteran
answered on 19 Oct 2020, 01:50 PM

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.

0
George Gindev
Telerik team
answered on 20 Oct 2020, 01:09 PM

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/.

Tags
Pager
Asked by
Glenn
Top achievements
Rank 1
Veteran
Answers by
George Gindev
Telerik team
Glenn
Top achievements
Rank 1
Veteran
Share this question
or