开发者社区> 问答> 正文

关于 jQuery Easyui的DataGrid使用的一个问题

页面中报错, jquery.js 中有一处报了length未定义,求指教

            $('#tb_helps').datagrid({
                url: '/Admin/PluginHelps/HotList', 
                title: '帮助内容列表',
                iconCls: 'icon-view',
                dataType:'json',
                height: 650,
                width: function () { return document.body.clientWidth * 0.9; },
                nowrap: true,
                autoRowHeight: false,
                striped: true,
                collapsible: true,
                pagination: true,
                pageSize: 100,
                pageList: [50, 100, 200],
                rownumbers: true,
                sortOrder: 'asc',
                remoteSort: false,
                idField: 'ID',
                columns: [[
                {
                    field: "Title",
                    title: "@T("Admin.ContentManagement.Helps.Help.Fields.Title")",
                    width: 300
                }, {
                    field: "DisplayOrder",
                    title: "@T("Admin.ContentManagement.Helps.Help.Fields.DisplayOrder")",
                    width: 150,
                }, {
                    field: "Detail",
                    title: "@T("Admin.ContentManagement.Helps.Help.Fields.Detail")",
                    width: 800,
                }, {
                    field: "Id",
                    title: "@T("Admin.Common.Edit")",
                    width: 125,
                    template: '<a href="HelpEdit/#=Id#">@T("Admin.Common.Edit")</a>'
                }
                ]]
            });

展开
收起
小旋风柴进 2016-03-26 08:39:34 2003 0
1 条回答
写回答
取消 提交回答
  • 请检查返回的json数据是不是一个数组

         $('#tb_helps').datagrid({
                    //url: '/data/test.json',
                    data:[
                        {
                            'Title':'Title',
                            'DisplayOrder':'DisplayOrder',
                            'Detail':'Detail',
                            'ID':"1",
                        }
                    ]
                    ,
                    title: '帮助内容列表',
                    iconCls: 'icon-view',
                    dataType:'json',
                    height: 650,
                    width: function () { return document.body.clientWidth * 0.9; },
                    nowrap: true,
                    autoRowHeight: false,
                    striped: true,
                    collapsible: true,
                    pagination: true,
                    pageSize: 100,
                    pageList: [50, 100, 200],
                    rownumbers: true,
                    sortOrder: 'asc',
                    remoteSort: false,
                    idField: 'ID',
                    columns: [[
                    {
                        field: "Title",
                        title: "Title",
                        width: 300
                    }, {
                        field: "DisplayOrder",
                        title: "DisplayOrder",
                        width: 150,
                    }, {
                        field: "Detail",
                        title: "Detail",
                        width: 800,
                    }, {
                        field: "Id",
                        title: "Id",
                        width: 125,
                        template: '<a href="HelpEdit/#=Id#">@T("Admin.Common.Edit")</a>'
                    }
                    ]]
                });
    2019-07-17 19:15:06
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关课程

更多

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载


http://www.vxiaotou.com