剑道网格无法显示数字记录



""剑道UI网格""

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

网格页脚显示"没有要显示的项目"

上一个和下一个符号<lt<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: "&nbsp;", 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"}]}

在这种情况下,您需要查看网络流量。在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 }
    ]
}

最新更新