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

Grid Page change issue.

1 Answer 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
stephen
Top achievements
Rank 1
stephen asked on 22 Aug 2012, 09:10 AM
Hi guys, I've got a strange problem with my grid that has server side paging.

what we have done is abstract the the Kendo grid away from out current code using obtrusive javascript like so

   var options = {
        reorderable: $(element).attr("data-grid-reorderable"),
        autoBind: $(element).attr("data-grid-autoBind"),
        groupable: $(element).attr("data-grid-groupable"),
        width: $(element).attr("data-grid-width"),
        height: "400",
        scrollable: true,
        columns: columns,
        dataSource: {
            transport: { read: { url: $(element).attr("data-grid-datasource-url"), data: window[$(element).attr("data-grid-datasource- data")] } },
            sortable: { mode: "multiple", allowUnsort: true },
            type: "aspnetmvc-ajax",
            filter: [],
            group: groups,
            schema: {
                data: $(element).attr("data-grid-schema-data"),
                total: $(element).attr("data-grid-schema-total"),
                errors: $(element).attr("data-grid-schema-errors"),
                model: model,
                scrollable: true
            },
            pageSize: $(element).attr("data-grid-datasource-pagesize"),
            serverPaging: $(element).attr("data-grid-datasource-pageable"),
            serverFiltering: $(element).attr("data-grid-datasource-filtering"),
            serverSorting: $(element).attr("data-grid-datasource-sortable")
        },
        pageable: $(element).attr("data-grid-pageable"),
        columnMenu: true
    };

this all works fine for the first page of the grid but the problem is when the page changes we return the data in exactly the same data structure that worked on page 1 but it doesn't work on page 2? the grid is just empty.

Can anyone help with this? it's a very strange issue because it works perfectly fine on the first page.

cheers.
ste.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 27 Aug 2012, 08:22 AM
Hello Stephen,

The problem occurs because the values from the attributes will be of type string and not Number or Boolean. Converting the parameters should resolve the problem e.g.

serverPaging: $(element).attr("data-grid-datasource-pageable") != "false"
Kind regards,
Daniel
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
stephen
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or