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

Missing page links (paging)

3 Answers 234 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 17 Dec 2012, 10:56 AM
Hi all,

I've an issue with pagination with an HTML grid.

First I've generated a grid (from server-side code) which is "converted" in a KendoGrid from clien-side code:

<table id="grid">
            <thead>
                <tr>
                    <th data-field="field1"></th>
                    <th data-field="Id">MyFiels</th>
                </th>
            </thead>
            <tbody>
            <tr><td> (and so on..)
          </tbody>
        </table>

Now I convert the grid using the following code:

 $("#grid").kendoGrid({
            sortable: true,
            selectable: "row",
            height: 350,
            pageable: {
                refresh: false,
                pageSize: 30
            }
        });

I've trie to set a kind of "RecordCount" property in order to build a number of page links according to PageSize and "TotalRecordCount"
I've tried to set Schema.

schema: {total: 1000 }
 
but I didn't succedeed,

Any idea?

Note: The grid is built from server-side code, then redered and converted to KendoGrid, all things work as expected but page links are not displayed

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 19 Dec 2012, 09:17 AM
Hello Andrea,

To make this work you should set the pageSize in the DataSource configuration. Pager have a pageSizes option which is has a different purpose. Please check this example.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Andrea
Top achievements
Rank 1
answered on 19 Dec 2012, 11:24 AM
Thanks Alexander,

but I need something more, I have only a "partial" result on the client (say first 10 rows only) while on the server I have more (say 1000 total records)

I need something to tell pager to generate page links for me. When user clicks on a page link I need to "navigate to" the selected page, performing a full page get.

Any suggestions?
0
Alexander Valchev
Telerik team
answered on 19 Dec 2012, 05:41 PM
Hi Andrea,

I am afraid that what you would like to achieve is not supported. You can fake the total amount in this way:
dataSource: {
  pageSize: 3,
  schema: {
    total: function() { return 1000; }
  }
}

But as soon as the grid rebinds (e.g. page is changed) the pager will display only the actual page size.
My recommendation is to bind the Grid to remote data and configure serverPaging. Please check this demo.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Andrea
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Andrea
Top achievements
Rank 1
Share this question
or