私信  •  关注

Kokirala Sudheer

Kokirala Sudheer 最近回复了
5 月前
回复了 Kokirala Sudheer 创建的主题 » 带有自定义分页和动态列的kendo网格(jquery)
var content = createkendoDataSource(sr, APIRequest);

                var configuration = {
                    dataSource: content,
                    scrollable: false,
                    pageable: {
                        input: false,
                        numeric: true,
                        butonCount: 5,
                        pageSize: 10,
                        alwaysVisible: true,
                        previousNext: true
                    },
                    columns:sr.columns,
                    serverPaging: true
                };

                var grid = $("#gridSamples").kendoGrid(configuration).data("kendoGrid");
                grid.setOptions({ columns: columns });

                grid.bind("page", pageChange);
                grid.dataSource.page(page);    

function createkendoDataSource(res, APIRequest) {
        var dataSource = new kendo.data.DataSource({
            serverPaging: true,
            transport: {
                read: function (options) {
                    options.success(res);
                }
            },
            pageSize: 10,
            schema: {
                model: res,
                data: "results.results",
                total: "totalRecords"
            }
        });
    return dataSource;
}