开发者社区> 问答> 正文

TreeGrid数据不显示

TreeGrid数据不显示,js也没有报错。不知道原因。

$('#test2').treegrid({
        url: '../../PurSelectGoodsCTL/CalculatePlanInfo?calculate='+ss.toString(),
        title: 'TreeGrid - ContextMenu',
        width: 1200,
        height: 500,
        fitColumns: true,
        rownumbers: true,
        idField:'id',
        treeField:'物料编码',
        columns:[[
            {field:'物料编码',title:'物料编码',width:80},
            {field:'物料名称',title:'物料名称',width:120},
            {field:'物料规格',title:'物料规格',width:120},
            {field:'计量单位',title:'计量单位',width:30,align:'right'},
            {field:'单位用量',title:'单位用量',width:30,align:'right'},
            {field:'库存数量',title:'库存数量',width:30,align:'center'},
            {field:'备注',title:'备注',width:60,align:'center'},
            {field:'物料编码bom',title:'物料编码bom',width:60,align:'center'}
        ]]
    });

这是后台发过来的数据
screenshot

{"total":117,"rows":[
    {"id":1,"code":"code1","name":"name1","addr":"address1"},
    {"id":11,"code":"code11","name":"name11","addr":"address11","_parentId":1},
    {"id":2,"code":"code2","name":"name2","addr":"address2","state":"closed"},
    {"id":21,"code":"code21","name":"name21","addr":"address21","_parentId":2},
    {"id":22,"code":"code22","name":"name22","addr":"address22","_parentId":2},
    {"id":3,"code":"code3","name":"name3","addr":"address3","state":"closed"}
]}

screenshot

展开
收起
a123456678 2016-07-07 14:53:30 2735 0
1 条回答
写回答
取消 提交回答
  • JSONArray ja = JSONArray.fromObject(ls);
            JSONObject jo=new JSONObject();
            jo.put("total", ls.size());
            jo.put("rows", ja);
            System.out.println(jo.toString());
            response.getWriter().write(jo.toString());
    
    <span></span> <span></span>
    2019-07-17 19:52:50
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

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