qq_39634344 2019-07-25 09:51 采纳率: 0%
浏览 783

easyui-datagrid 的load,loadData到底怎么用?感觉怎么用都不显示数据呢?

大哥们帮忙看看,下面是jsp代码

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../plugins/easyui/themes/bootstrap/easyui.css"/>
<link rel="stylesheet" type="text/css" href="../plugins/easyui/themes/icon.css"/>
<link rel="stylesheet" type="text/css" href="../plugins/easyui/themes/color.css"/>
<link rel="stylesheet" type="text/css" href="../plugins/easyui/demo/demo.css"/>
<script type="text/javascript" src="../plugins/easyui/jquery.min.js"></script>
<script type="text/javascript" src="../plugins/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../plugins/easyui/local/easyui-lang-zh_CN.js"></script>

 <style type="text/css">

</style>

</head>
<body>
<table id='grid' class='easyui-datagrid' style='width:1100px;height:500px' 
            title='用户列表' iconCls='icon-table'  rownumbers='true' fitColumns='true' singleSelect='true' toolbar='#toolbar' >  
        <thead>  
            <tr>  
                <th field='id' width='50' align='center'>id</th>  
                <th field='name' width='70'align='center'>name</th>   
            </tr>  
        </thead>  
    </table>    
</body>
<script type="text/javascript">
    var obj = {"total":2,"rows":[{id:"1",name:"一"},{id:"2",name:"二"}]};   
    $('#grid').datagrid('loadData',obj);
</script>   
</html>

使用load也不显示出来,不知道该怎么做了

  • 写回答

1条回答 默认 最新

  • renkai721 2019-07-25 10:05
    关注

    试下

    $("#grid").datagrid("loadData", 
                        {
                               "total": 2, 
    
                               "rows": [{ "ck": "1", "no": "1001", "name": "zhangsan", "object": ".net", "score": "77" },
                                       { "ck": "1", "no": "1002", "name": "zhangsan", "object": "vb", "score": "71" }]
                            });
                            //ck是checkbox,开始datagrid一直绑定不了数据,因为ck键对应的值是1,而不是"1",JSON中一定都是要双引号。
    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛