0
点赞
收藏
分享

微信扫一扫

Kendo grid设置当前页

西曲风 2022-03-30 阅读 183
.netkendo

1、Kendo grid设置当前页 

           var grid = $('#userAddGrid').data('kendoGrid');
           grid.dataSource.page(1);
           grid.dataSource.read({ Filter: this.value, MaxResultCount: 100 });

2、Kendo grid服务端分页,查询参数自定义,参数匹配

 $("#userAddGrid").kendoGrid({
            autoBind: false,
            dataSource: {
                type: "json",
                transport: {
                   read: "/api/identity/users",
                   parameterMap : function(options, operation) {
                       if (operation == "read") {
                       var parameter = "SkipCount="+options.skip+"&MaxResultCount"+ options.pageSize;
                       if (options.Filter!=undefined)
                           parameter +="&Filter="+options.Filter;
                       return parameter;
                     }
                    }
                },
                pageSize: 10,
                serverPaging: true,
                schema: {
                    data: "items",
                    total: "totalCount",
                    model: {
                        id: "id",
                        fields: {
                           
                        }
                    }
                }
            },
            width: "100%",
            height: 550,
            sortable: true,
            editable: false,
            filterable:true,
            pageable: {
                input: true,
                numeric: false
            },
            persistSelection: true,
            toolbar: kendo.template($("#userAddGridToolbarTemplate").html()),
            columns: [
                { selectable: true, width: "50px" },
                { field: "userName", title: "账号", width: 100 },
                { field: "name", title: "名称", width: 100 },
                { field: "email", title: "邮箱", width: 100 },
            ]
        });

举报

相关推荐

0 条评论