kendo网格无法显示数字记录

时间:2013-08-19 01:38:27

标签: jquery kendo-ui kendo-grid

“”“Kendo UI Grid”“”

我的网格无法显示数字记录和总页数以及下一页

网格页脚显示“无要显示的项目”

上一个和下一个符号<< < 0> >>

我把可分页或页面大小但为什么不显示T_T

请帮帮我!!!

                    var dataSourceUser = new kendo.data.DataSource({            
                        transport: {
                            read: "adminUser.php?action=view",
                            destroy: {
                                url: function (options) {
                                $.ajax(
                                    {
                                        type: 'POST',
                                        url: 'adminUser.php?action=delete',
                                        data: { 
                                                    UserID: options.UserID
                                        },
                                        complete: function(e) {
                                              $("#gridUser").data("kendoGrid").dataSource.read(); 
                                         }                                          
                                    });
                                return;
                                },
                                dataType : "json"
                            },
                            create: {
                                url: function (options) {
                                $.ajax(
                                    {
                                        type: 'POST',
                                        url: 'adminUser.php?action=create',
                                        data: { 
                                                    Username: options.Username,  
                                                    Password: options.Password, 
                                                    PCUID: options.PCUID,  
                                                    adp_id: options.adp_id
                                        },
                                        complete: function(e) {
                                              $("#gridUser").data("kendoGrid").dataSource.read(); 
                                         }                                          
                                    });
                                return;
                                },
                                dataType : "json"
                            },
                            update: {
                                url: function (options) {
                                $.ajax(
                                    {
                                        type: 'POST',
                                        url: 'adminUser.php?action=update',
                                        data: { 
                                                    UserID: options.UserID,
                                                    Username: options.Username,  
                                                    Password: options.Password, 
                                                    PCUID: options.PCUID,  
                                                    adp_id: options.adp_id
                                        },
                                        complete: function(e) {
                                              $("#gridUser").data("kendoGrid").dataSource.read(); 
                                         }                                          
                                    });
                                return;
                                },
                                dataType : "json"
                            },
                            parameterMap: function(options, operation) {
                                if (operation !== "read") {
                                    return {models: kendo.stringify(options.models)};
                              } 
                              return options;
                            } 
                        },
                        batch: false,
                        pageSize: 15,
                        schema: {
                            data: "data",
                            model: {
                                id: "UserID",
                                fields: {
                                    UserID: { editable: false, nullable: true },
                                    Username: { validation: { required: true } },
                                    Password: { validation: { required: true } },
                                    PCUID: { validation: { required: true } },
                                    adp_id: { validation: { required: true } }
                                }
                            }
                        }
                    });

                $("#gridUser").kendoGrid({
                    dataSource: dataSourceUser,
                    pageable: true,
                    toolbar: ["create"],
                    pageable: true,
                    columns: [
                        { field:"UserID", title: "UserID", width: "100px" },
                        { field:"Username", title: "Username", width: "100px" },
                        { field:"Password", title: "Password", width: "200px" },
                        { field:"PCUID", title: "PCUID", width: "100px" },
                        { field:"adp_id", title: "adp_id", width: "200px" },
                        { command: ["edit", "destroy"], title: " ", width: "160px" }],
                    editable: "popup"
                }); 

adminUser.php

{"data":[{"UserID":"1","Username":"test1","Password":"1234","PCUID":"001","adp_id":"1"},{"UserID":"2","Username":"test2","Password":"1234","PCUID":"002","adp_id":"2"}]}

1 个答案:

答案 0 :(得分:0)

在这种情况下,您需要查看网络流量。在Chrome中,只需按F12,然后转到“网络”标签。

一旦出现(根据浏览器的不同而不同),您应该看到您对“adminUser.php?action = view”的请求,希望结果是JSON,并提供所请求的数据。

根据您的设置预期:

{
    data: [
        { UserID: 123, Username: 'abc', Password: 'abc', PCUID: 123, adp_ip: 123 },
        { UserID: 456, Username: 'abc', Password: 'abc', PCUID: 123, adp_ip: 123 }
    ]
}