gavinchengshubo 2015-04-22 01:53 采纳率: 0%
浏览 2318
已结题

easyui最简单的数据绑定,绑定不上

 $(function () {
            LoadDataGrid(); //加载列表数据                           
 });

 //列表
        function LoadDataGrid() {
            $("#Infolist").datagrid({
                loadMsg: '数据加载...',
                url: 'lpdata.json',
                columns: [[
                { field: 'tHI_Code', title: '楼盘code', width: 80, align: 'center' },
                { field: 'tHI_Name', title: '项目名称', width: 300, align: 'center' },
                { field: 'tBA_ID_District', title: '区域', width: 80, align: 'center' },
                { field: 'tHI_Clicks', title: '点击次数', width: 80, align: 'center' },
                { field: 'tHI_Published', title: '发布时间', width: 100, align: 'center' },
                { field: 'tHI_Updated', title: '更新时间', width: 120, align: 'center' }
                ]]
            });
        }
            --表格table
                 <table id="Infolist">
        </table>
            --json数据
        {
    "total": 173,
    "rows": [
        {
            "thi_id": "01fbaa5289434f2a9ce07682d1adf3e2",
            "thi_code": "kaiyueguangchang0592",
            "thi_name": "凯悦广场",
            "tba_id_district": "001008000",
            "thi_clicks": "151",
            "thi_published": "2013/10/16 10:51:31",
            "thi_updated": "2014/5/4 17:25:28"
        },               
        {
            "thi_id": "0b36583701a8439e9f5e20a6f1ab453a",
            "thi_code": "guojilongjundz",
            "thi_name": "大洲国际龙郡",
            "tba_id_district": "001001000",
            "thi_clicks": "19",
            "thi_published": "2013/10/16 10:50:50",
            "thi_updated": "2013/10/28 10:37:35"
        }
    ]
}
  • 写回答

3条回答 默认 最新

  • Go 旅城通票 2015-04-22 02:09
    关注

    注意field配置的大小写要和数据源字段一致。如果你发布网站后访问还得确认你的服务器支持.json后缀的文件才行,iis默认是不支持.json文件的

    本地file访问不要用chrome等webkit核心浏览器,ajax无法请求文件

         function LoadDataGrid() {
            $("#Infolist").datagrid({
                loadMsg: '数据加载...',
                url: 'lpdata.json',
                columns: [[
                    { field: 'thi_id', title: '楼盘code', width: 80, align: 'center' },
                    { field: 'thi_name', title: '项目名称', width: 300, align: 'center' },
                    { field: 'tba_id_district', title: '区域', width: 80, align: 'center' },
                    { field: 'thi_clicks', title: '点击次数', width: 80, align: 'center' },
                    { field: 'thi_published', title: '发布时间', width: 100, align: 'center' },
                    { field: 'thi_updated', title: '更新时间', width: 120, align: 'center' }
                    ]]
            });
        }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘