Kendo Grid分页无法正常工作

时间:2015-05-22 21:46:41

标签: javascript asp.net-mvc kendo-grid

我通过AJAX POST进行数据分页,并返回json结构,如:

{
    Total: 6,
    Data: {
        {id:1,field2:'xx'},
        {id:2,field2:'xx2'},
    }
}

网格数据源按以下方式配置:

 grid.dataSource = new kendo.data.DataSource({
                serverPaging: true,
                pageSize: 2,
                schema: {
                    data: "Data",

                    // using function for testing purposes, it goes into after data.success is set and returns 6 
                total: function(r) {
                    return r.Total;
                },
                transport: {
                    read: function(data) {
                        var token = $('[name=__RequestVerificationToken]').val();
                        var headers = {};
                        headers["__RequestVerificationToken"] = token;

                        $.ajax({
                            url: listUrl,
                            headers: headers,
                            contentType: 'application/json',
                            data: self.getFilterData(),
                            type: 'POST',
                            async: false,
                            success: function(result) {
                                data.success(result);
                            }
                        });
                    },
                }

数据已成功绑定,但寻呼机无法正常工作且未显示。这里缺少什么?

由于

1 个答案:

答案 0 :(得分:1)

寻呼机也需要绑定到数据源:

$("#pager").kendoPager({
    autoBind: false,
    dataSource: grid.dataSource
});