How to change Kendo UI grid page index programmatically?

44,537

Solution 1

You might to use:

grid.dataSource.query({ page: 3, pageSize: 20 });

Documentation in here.

or:

grid.dataSource.page(3);

Documentation in here

Solution 2

Answer is just set it pate: 1 when datasource created

var dataSource = new kendo.data.DataSource({
  data: [
    { name: "Tea", category: "Beverages" },
    { name: "Coffee", category: "Beverages" },
    { name: "Ham", category: "Food" }
  ],
  page: 1,
  // a page of data contains two data items
  pageSize: 2
});
Share:
44,537
Lajos Arpad
Author by

Lajos Arpad

I was very much interested how computer games work as a kid. I have seen that game graphics are displayed and the logic of the game works well, yet, I knew that this was physically manifested as cables. I decided to become a programmer, since I wanted to know what was behind the wonder that based on cables and electricity a virtual reality is created. Also, I realized that I should not choose another profession, since my handwriting is unreadable. As a kid, nobody took me seriously and when I had a question about programming, I had to go to the library to find the right chapter in the right book. Today, this has become simpler and I am happy to contribute to helping other fellow programmers. In the spirit of Knuth, I consider programming an art and I improve my source-code until I no longer see the difference between profession and art.

Updated on March 22, 2020

Comments

  • Lajos Arpad
    Lajos Arpad over 4 years

    I have a kendo ui grid. Let's say that the JS variable pointing to the grid is called grid. How can I go to page 3 programmatically? Thanks.