Easyui datagrid不显示数据

刚接触easyui,不太熟,根据datagrid的格式拼装了数据,无法显示到datagrid里,但是在jsp里面创建一个var变量就可以显示,求大牛帮忙看下

JSP页面代码:

 $(function() {
    //alert(getParasFromUrl("selectType"));
    //alert(getParasFromUrl("objectID"));
    //初始化表格内容
    $('#dataList').datagrid({
        title : 'IP地址详情',
        //data:dataGrid,
        method : 'post',
        singleSelect : true,
        height : 370,
        fit : true,
        fitColumns : true,
        striped : true,
        collapsible : true,
        //url : "/jsp/jcss/IPQueryDetailAction.do?operation=queryIPFromDB",
        url : "/InfoMgr/jsp/jcss/IPQueryDetailAction.do?operation=query&selectType="+getParasFromUrl("selectType") + "&objectID=" + getParasFromUrl("objectID"),
        sortName : 'IP',
        pageSize: 50, //每页显示的记录条数,默认为10
        pageList: [30, 50, 100, 200, 300],  //分页显示选项
        sortOrder : 'asc',
        remoteSort : false,
        idField : 'ID',
        pagination : true, // 显示分页
        rownumbers : true, // 显示行号
        columns : [ [
                    {field : 'ID', title : '序号', width : 20, sortable : true, halign : 'center'},
                    {field : 'IP', title : 'IP', width : 100, sortable : true, halign : 'center'},
                    {field : 'HOSTNAME', title : '主机名称', width : 100, sortable : true, halign : 'center'},
                    {field : 'GATEWAY', title : '网关', width : 80, sortable : true, halign : 'center'},
                    {field : 'USEFOR', title : '用途', width : 120, sortable : true, halign : 'center'},
                    {field : 'PROPOSER', title : '申请人', width : 120, sortable : true, halign : 'center'},
                    {field : 'CREATEDATE', title : '申请时间', width : 120, sortable : true, halign : 'center'},
        ] ],
        onLoadSuccess : function() {
            //alert('OK');
            //$('#dataList').datagrid('reload');
            //$('#dataList').datagrid('clearSelections'); // 一定要加上这一句,要不然datagrid会记住之前的选择状态,删除时会出问题
        },
        onDblClickRow: function (rowIndex, rowData) {

        },
        onClickRow: function (rowIndex, rowData) {

        },

    });
});

后台数据拼装:

    public List getIPSegFromDB(String ID){
        System.out.println("call getIPSegFromDB");
        List<String> lstIPs = new ArrayList<String>();

        StringBuffer sb = new StringBuffer();
        sb.append("{\"total\":28,\"rows\":[");
        sb.append("{\"ID\":\"1\",\"IP\":\"192.168.1.1\",\"HOSTNAME\":\"test\",\"GATEWAY\":\"192.168.1.254\",\"USEFOR\":\"测试\",\"PROPOSER\":\"11\",\"CREATEDATE\":\"2015-11-21\"},");
        sb.append("{\"ID\":\"2\",\"IP\":\"192.168.1.2\",\"HOSTNAME\":\"test\",\"GATEWAY\":\"192.168.1.254\",\"USEFOR\":\"测试\",\"PROPOSER\":\"111\",\"CREATEDATE\":\"2015-11-21\"}");
        sb.append("]}");

        lstIPs.add(sb.toString());
        return lstIPs;
    }

返回json:

 response.getWriter().print(JSONArray.fromObject(qis.getIPSegFromDB(objectID)).toString()); 

鼓捣一晚上了没查出问题来,但是按照下面的格式写到jsp页面里,就能显示出来。。。。求解啊。。。

 var dataGrid = {"total":28,"rows":[
    {"ID":"1","IP":"192.168.1.1","HOSTNAME":"test","GATEWAY":"192.168.1.254","USEFOR":"测试","PROPOSER":"111","CREATEDATE":"2015-11-21"},{"ID":"2","IP":"192.168.1.2","HOSTNAME":"test","GATEWAY":"192.168.1.254","USEFOR":"测试","PROPOSER":"111","CREATEDATE":"2015-11-21"},
    {"ID":"1","IP":"192.168.1.1","HOSTNAME":"test","GATEWAY":"192.168.1.254","USEFOR":"测试","PROPOSER":"111","CREATEDATE":"2015-11-21"},{"ID":"2","IP":"192.168.1.2","HOSTNAME":"test","GATEWAY":"192.168.1.254","USEFOR":"测试","PROPOSER":"111","CREATEDATE":"2015-11-21"}
                           ]};
0

6个回答

终于解决了,后台print的方法写的有问题,应该用JSONObject.fromObject(String),不能用JSONArray.fromObject(String),关闭问题

0

看下是不是json的解析不正确

1
Fighter_wjl
Fighter_wjl --->[{"total":28,"rows":[{"ID":"1","IP":"192.168.1.1","HOSTNAME":"test","GATEWAY":"192.168.1.254","USEFOR":"测试","PROPOSER":"11","CREATEDATE":"2015-11-21"},{"ID":"2","IP":"192.168.1.2","HOSTNAME":"test","GATEWAY":"192.168.1.254","USEFOR":"测试","PROPOSER":"11","CREATEDATE":"2015-11-21"}]}]
3 年多之前 回复
Fighter_wjl
Fighter_wjl 后台解析应该没问题,print到前段之前打印出的结果为:
3 年多之前 回复

在我正确的按照例子从后台s......
答案就在这里:easyui datagrid数据不显示
----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?

0

浏览器访问url : "/InfoMgr/jsp/jcss/IPQueryDetailAction.do?operation=query&selectType="+getParasFromUrl("selectType") + "&objectID=" + getParasFromUrl("objectID")这个地址看输出什么

0
Fighter_wjl
Fighter_wjl 能输出json格式的数据:[{"total":2,"rows":[{"ID":"1","IP":"192.168.1.1","HOSTNAME":"test","GATEWAY":"192.168.1.254","USEFOR":"??","PROPOSER":"11","CREATEDATE":"2015-11-21"},{"ID":"2","IP":"192.168.1.2","HOSTNAME":"test","GATEWAY":"192.168.1.254","USEFOR":"??","PROPOSER":"11","CREATEDATE":"2015-11-21"}]}]
3 年多之前 回复

图片说明

显示出来是一个空行

0

JSONArray.fromObject()这个方法好像解析不了集合吧

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
easyui datagrid 不显示数据问题
![图片说明](https://img-ask.csdn.net/upload/201707/25/1500922234_974788.jpg)rnrnjsp代码:rnrnrn```rn <%@ page language="java" contentType="text/html; charset=UTF-8"rn pageEncoding="UTF-8"%>rnrnrnrn rn 用户信息rnrn<%@include file="/public/head.jspf"%>rnrn rn rn 注册时间rn 手机号rn rn 筛选rnrn rnrnrn rnrnrn```rnrnrnrn格式返回应该没错, 页面也没有报错,就是不显示数据,求解
easyui datagrid 不显示第一页数据
问个很白的问题。。别笑话我。。。rn打算页面打开后,就直接显示数据,rn但是现在必须点一下分页栏上的刷新才显示。倒也显示页数和记录数,请教这是怎么回事啊? rnrn```rn rn```rnrn
bootstrap弹出框不显示EasyUI dataGrid数据
修改 弹出框为bootstrap弹出框 bootstrap弹出框不显示EasyUI dataGrid数据: 解决办法,在 dataGrid加载前加上 代码: $('#myModal').on("shown.bs.modal",function(){ $('#listDataTable').datagrid('resize'); }); ...
easyui中datagrid 不显示数据
之前并没有系统使用easyui组件的机会。本次也是在基于该前端框架下完成一个简单的查询功能并展示的问题。 datagrid即数据网格,用于展示列表数据,以行为单位且支持分页。 问题背景:根据查询参数查询符合条件的数据。前端使用easyUI,后端使用spring mvc。 然而根据条件查询只会返回一条数据,因此也没有考虑分页什么的。 现象:后台以JSON格式返回,键值与前端的field的名称...
jquery easyui datagrid 不显示
我再table中加入class="easyui-datagrid",结果内容就不显示了,是什么原因造成的。特殊说明,我用的不是jsp,是.ftl文件,引用几行代码:[code=html] rn rn rn rn rnrn rnrn[/code]rn在调试工具中显示的是rn[code=html]rnrn rn rn rn rnrn[/code]
easyui datagrid 不显示json数据
过程描述:页面 A输入参数,进入controller进行逻辑处理并生成json数据,然后通过rn MVC返回json数据,并对页面A相关easyui datagrid表格进行数据展示。rn 问题:easyui datagrid不现实数据,且页面不报错,调试能看到json数据。rn 页面代码: rn rn rnrn```rn 测试rn function test()rn rn jq('#tt').datagrid(rn title:'DataGrid - DetailView',rn width:500,rn height:250,rn remoteSort:false,rn singleSelect:true,rn nowrap:false,rn fitColumns:true,rn type:"POST",rn url:'/store/saleout/getjson',rn columns:[[rn field:'product_name',title:'Item ID',width:80,rn field:'numbers',title:'Product ID',width:100,sortable:true,rn field:'price',title:'List Price',width:80,align:'right',sortable:true,rn field:'buyer',title:'Unit Cost',width:80,align:'right',sortable:truern ]]rn rn );rn alert("333");rn rn```rnrnrn 调试显示数据:"rows":["product_name":"土豆","numbers":2,"price":40,"buyer":"A","style":"A","type":"WU","saleoutdate":"2015-3-31"],"total":1rn rn 请教一下:什么原因导致 easyui datagrid数据不显示?不报错,不知道到底从哪里入手,困扰了不短时间,多谢!!rn rn 页面完整代码如下,调试数据截图在附件中。rn ![![图片说明](https://img-ask.csdn.net/upload/201505/31/1433004879_544586.png)图片说明](https://img-ask.csdn.net/upload/201505/31/1433004871_778225.png)rnrnrn```rn rn rn<%@ page language="java" contentType="text/html; charset=utf-8"rn pageEncoding="utf-8"%>rn<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>rn<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>rn<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>rn<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>rn<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>rnrnrnrnrnrn rn saleoutrn rnrn rnrnrnrnrnrnrn rn rn rn rn rn rn 测试rn rn rnrnrn rn rn rn rn 产品名称: rn rn rn rn rn rn 提交rn rn rnrnrnrnrn```rn
easyui datagrid 数据的显示和查询
引用css、js 初始化DataGrid $(document).ready(function() { $("#table").datagrid({ 'url':'${pageContext.request.contextPath}/Data.do',//异步请求数据的url 'fitCo
easyui datagrid数据显示不出来
在我正确的按照例子从后台取数后,前台无法显示(都不报错,数据正常),发现去除几个字段可以显示,加上就无法显示,很无奈,后来才发现,返回的数据中出现了空格 还有\r \n 类似于\ 这种符号,可能由于easyui datagrid 不识别这类数据,然后就展示空白,希望小伙伴们注意了
easyui datagrid用 insertRow 添加一行数据 数据不显示
rn```rn rn rn rn rn rn rn 用户列表rn rn rn 保单列表rn rn rn 添加用户rn rn rn 添加表单rn rn rn 用户管理rn rn rn 表单管理rn rn rn rn rn rn rn rnrnrn $('#userManage').on("click",function()rn if(flog3==0)rn flog3+=1;rn $('#tt').tabs('add',rn title:'用户管理', rn content:' 用户名: ', rn closable:true, rn tools:[ rn iconCls:'icon-mini-refresh', rn handler:function() rn alert('refresh'); rn rn ] rn );rn $('#dg3').datagrid(width:'100%',height:'100px', rn columns:[[ rn field:'id',title:'ID',width:100, rn field:'loginId',title:'用户名',width:100, rn field:'name',title:'姓名',width:100,rn field:'a',title:'操作',width:100,formatter:function(value,row,index)rn return '修改/删除';rn ,align:'right'rn ]] rn );rn elsern $('#dg3').datagrid("reload");rn rn rn );rn rn function chaxun()rn var loginId = $("#text1").val();rn //把loginId传到后台rn $.ajax(rn url:"$basePath/dba/checkLoginId",rn type:"post",rn data:"loginId":loginId,rn dataTypt:"json",rn success:function(result)rn if(result==0)rn $("#m3").css("color":"#00ff00").text("用户名不存在");rn elsern console.log(result);rn $('#dg3').datagrid("insertRow",rn index:0,rn row:rn id:result.id,rn loginId:result.loginId,rn name:result.namern rn );rn rn rn );rnrn```rn数据能获取,但添加的行里没有数据rn![图片说明](https://img-ask.csdn.net/upload/201805/13/1526223042_426471.jpg)rn点“用户管理”的时候会生成一个选项卡,这个选项卡输入用户名再点查询按钮如果用户名存在可以添加一行数据在datagrid里,现在用户信息可以查到,但是现在数据无法写入到datagrid中
datagrid不显示数据
绑定了行不显示值,代码如下:rnasp:BoundColumn DataField="CLASSID" HeaderText="料件分类Id" SortExpression="PART_CLASSID">rn rn rn rn rn rn另外加了个删除列。rndatagrid1.datasource=dataset1.rndataset1里面有值,为什么不显示啊。
DataGrid不显示数据??
代码如下:rnPrivate Sub Form_Load()rn Dim Rs_User_Code As ADODB.Recordsetrn Dim strSqlSelect As Stringrn Dim i As Integerrn rn strSqlSelect = "Select Code As '用户名' From User_Code"rn '打开数据库连接 开始rn mOpenDBrn '打开数据库连接 结束rn rn Set Rs_User_Code = New ADODB.Recordsetrn Rs_User_Code.CursorLocation = adUseClientrn Rs_User_Code.Open strSqlSelect, mPlc_Connection, 3, 1rn If Not Rs_User_Code.EOF Or Not Rs_User_Code.BOF Thenrn '记录集不为空rn Set DGrid_UserPower.DataSource = Rs_User_Codern 'MsgBox (DGrid_UserPower.Columns(0))rn 'DGrid_UserPower.Refreshrn rn Elsern '记录集为空rn End Ifrn Rs_User_Code.Closern Set Rs_User_Code = Nothingrn '关闭数据库联系 开始rn mCloseDBrn '关闭数据库联系 结束rnEnd SubrnrnMsgBox (DGrid_UserPower.Columns(0))还有数据,就是不显示rnrn要显示的是一个字段中的内容rnrn另在表中现在只有两条记录rnrn也有 Rs_User_Code.CursorLocation = adUseClientrnrn请高手们帮忙!!谢谢!
easyUI tree不显示数据
如题,在后台把数据转换为树形结构,打印出来都是对的,但是就是无法显示在tree上,rn这是树形json数据:rn"id":135064,"text":"sinux","depid":0,"children":["id":235100,"text":"行政部","depid":135064,"children":["id":235101,"text":"人事部","depid":235100,"children":[],"id":235102,"text":"财务管理","depid":235100,"children":["id":235103,"text":"审计部","depid":235102,"children":[],"id":235114,"text":"财务部","depid":235102,"children":[]]],"id":235104,"text":"市场部","depid":135064,"children":["id":235105,"text":"采购部","depid":235104,"children":[],"id":235106,"text":"营销部","depid":235104,"children":[],"id":235113,"text":"客户服务部","depid":235104,"children":[]],"id":235107,"text":"项目部","depid":135064,"children":["id":235108,"text":"研发部","depid":235107,"children":["id":235109,"text":"开发部","depid":235108,"children":["id":235115,"text":"软件一部","depid":235109,"children":[],"id":235116,"text":"软件二部","depid":235109,"children":[],"id":235117,"text":"软件三部","depid":235109,"children":[],"id":235118,"text":"软件四部","depid":235109,"children":[]],"id":235110,"text":"测试部","depid":235108,"children":[],"id":235112,"text":"设计部","depid":235108,"children":[]],"id":235111,"text":"运维部","depid":235107,"children":[]]]rnrn这是jsp代码rn rn rn rn rnrn来个大佬,让我学习下
easyui combo 不显示数据
rnrn$('#commodityTypeCombox').combobox(rn url:contextPath + '/sample/findTypeList.pvt',rn valueField:'id',rn textField:'name'rn );rnrn通过url数据已经加载到前台,但是不显示数据,加载到前台数据格式为:rnrn"commodityTypeList":["id":"1","name":"厨房用品","id":"2","name":"电子产品","id":"3","name":"其他"]rnrn后台代码为rn@Action(value = "findTypeList", results = @Result(type = "json", params = "includeProperties",rn " commodityTypeList\\[\\d+\\]\\.id, commodityTypeList\\[\\d+\\]\\.name" ) )rn public String findTypeList() rn this.commodityTypeList = commodityBiz.findTypeList();rn return SUCCESS;rn rnrn为什么数据已经到达前台但是不显示呢?
easyui datagrid 底部分页栏不显示
如图rn[img=https://img-bbs.csdn.net/upload/201610/14/1476413730_387485.jpg][/img]rn现在分页栏显示不出来,怎么办?rn贴上我的页面代码[code=javascript]rn var time = $("#time").val();rn $('#tt').datagrid( rn title: "省市单位数据", rn url: '<%=request.getContextPath()%>/Sgszbzs/getGriddataBySql?kpiid='+id+'&time='+time, rn pageSize:30,rn //high:100%,rn rowStyler: function(index,row)rn return 'font-size:10px;';rn ,rn pageList : [30,40,50],//可以选择的分页集合rn nowrap : true,//设置为true,当数据长度超出列宽时将会自动截取rn striped : true,//设置为true将交替显示行背景。rn collapsible : true,//显示可折叠按钮rn fitColumns:true,//允许表格自动缩放,以适应父容器rn pagination : true,//分页rn rownumbers : true,//行数rn columns: [ rn [ rn field: 'dwbm', title: '单位编码', width: 100, align: "center", rn field: 'dwmc', title: '单位名称', width: 130, align: "center", rn field: 'dwjb', title: '单位级别', width: 100, align: "center",rn field: 'zbjg', title: '指标结果', width: 100, align: "center",rn field: 'sfyj', title: '是否预警', width: 100, align: "center",rn field: 'sfss', title: '是否申诉', width: 100, align: "center",rn field: 'gbgs', title: '指标公式', width: 280, align: "center",rn ] rn ] rn ); rn[/code]rnrn对应页面代码rn[code=html]rn rn rn[/code]
EasyUI datagrid不显示table信息问题
 一个页面同时有两个datagrid时,其中一个datagrid被调用后不显示table及其信息。如果你不是因为没有设置table宽高、不是因为写错单词或因copy忘了改两个datagrid的id造成的失误,那就检查哈你的table是不是写成这样了:如果是这样那就赶紧改吧:改完后刷新页面table及其信息就这样就神奇般出来了。...
easyui datagrid右边框不显示的解决方法
 将datagrid 的函数放在$(function(){})内,datagrid右边框就可以正常显示了
easyUI使用datagrid分页栏不显示
今天在使用easyUI的时候,发现一个很奇怪的问题,就是我的中部布局的div中在加了一个table后,里面表格的分页栏就不能显示出来了,不多说了,直接上代码吧 datagrid表格加载函数 $('#back_llzpj_datagrid').datagrid({   url : '/Examination2.0/assessmentpaper_findAllPointPaper.ac
jquery easyUi插件DataGrid数据不显示 求思路
[img=http://hi.csdn.net/attachment/201111/11/5389202_1321004356ZJvR.jpg][/img]rnrn问题在图片里面大家看看吧。rn图片可能没有显示完全 直接复制:http://hi.csdn.net/attachment/201111/11/5389202_1321004356ZJvR.jpg 打开rn谢谢了
jQuery EasyUI的datagrid数据不能在页面显示
使用ThinkPHP框架,在index.html中显示一个grid,但是数据显示不上去,只能显示表头。不知道怎么回事,路径都没什么问题的。rnindex.html页面的javascript代码如下。rn rnrnbody部分就是一个table, rnjson代码如下:rn"total":28,"rows":[rn "productid":"FI-SW-01","unitcost":10.00,"status":"P","listprice":36.50,"attr1":"Large","itemid":"EST-1",rn "productid":"K9-DL-01","unitcost":12.00,"status":"P","listprice":18.50,"attr1":"Spotted Adult Female","itemid":"EST-10",rn "productid":"RP-SN-01","unitcost":12.00,"status":"P","listprice":28.50,"attr1":"Venomless","itemid":"EST-11",rn "productid":"RP-SN-01","unitcost":12.00,"status":"P","listprice":26.50,"attr1":"Rattleless","itemid":"EST-12",rn "productid":"RP-LI-02","unitcost":12.00,"status":"P","listprice":35.50,"attr1":"Green Adult","itemid":"EST-13",rn "productid":"FL-DSH-01","unitcost":12.00,"status":"P","listprice":158.50,"attr1":"Tailless","itemid":"EST-14",rn "productid":"FL-DSH-01","unitcost":12.00,"status":"P","listprice":83.50,"attr1":"With tail","itemid":"EST-15",rn "productid":"FL-DLH-02","unitcost":12.00,"status":"P","listprice":63.50,"attr1":"Adult Female","itemid":"EST-16",rn "productid":"FL-DLH-02","unitcost":12.00,"status":"P","listprice":89.50,"attr1":"Adult Male","itemid":"EST-17",rn "productid":"AV-CB-01","unitcost":92.00,"status":"P","listprice":63.50,"attr1":"Adult Male","itemid":"EST-18"rn]rnrn详细代码见附件:rn[url=http://bbs.thinkphp.cn/forum.php?mod=viewthread&tid=48763][/url]
刚学easyui,使用datagrid数据不显示,页面空白
不报错,页面时完全空白的。。rn[code=HTML]rn<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>rnrnrnrn rn rn rn rn rn rn rn rn rn rnrnrn[/code]rn这是我的json数据,手写死的rn[code=XML]rn rn "total":10, rn "rows":[ rn "id":"001","user":"ok","title":"这款软件我非常满意","sendTime":"2012年1月1日 15:40",rn "id":"002","user":"zs","title":"I think so good","sendTime":"2012年1月1日 15:40",rn "id":"003","user":"zs","title":"这款软件我非常满意","sendTime":"2012年1月1日 15:40",rn "id":"004","user":"zs","title":"I think so good","sendTime":"2012年1月1日 15:40",rn "id":"005","user":"zs","title":"这款软件我非常满意","sendTime":"2012年1月1日 15:40",rn "id":"006","user":"zs","title":"I think so good","sendTime":"2012年1月1日 15:40",rn "id":"007","user":"zs","title":"这款软件我非常满意","sendTime":"2012年1月1日 15:40",rn "id":"008","user":"zs","title":"I think so good","sendTime":"2012年1月1日 15:40",rn "id":"009","user":"zs","title":"这款软件我非常满意","sendTime":"2012年1月1日 15:40",rn "id":"010","user":"zs","title":"I think so good","sendTime":"2012年1月1日 15:40"rn ] rn rnrn[/code]
ssh easyui datagrid不显示数据,初学者不知道怎么解决
[size=18px]本人在学习easyui,使用datagrid时没有拿到后台数据rn[/size][color=#FF6600][/color]rnrn下面是action文件 SortPageAction.javarnrnpackage com.hysd.action;rnrnimport java.util.ArrayList;rnimport java.util.Date;rnimport java.util.List;rnrnimport javax.annotation.Resource;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnimport org.apache.struts2.ServletActionContext;rnimport org.json.simple.JSONObject;rnrnimport com.hysd.service.PlanService;rnimport com.hysd.service.RecordService;rnimport com.hysd.service.UserService;rnimport com.opensymphony.xwork2.ActionSupport;rnrnpublic class SortPageAction extends ActionSupport rnrn /**rn * rn */rn private static final long serialVersionUID = 1L;rnrn @Resourcern private PlanService planService; // 通过Spring 注解 planService CTRL+鼠标点击rnrn private Integer planId;rnrn private Date planStartDate;rn private Date planEndDate;rn private Date planSubmitDate;rn private String planTitle;rn private String planContent;rn private Integer planState;rnrn private String rows;// 每页显示的记录数rn private String page;// 当前第几页rnrn private List list = new ArrayList();rn private JSONObject jsonObj = new JSONObject();rnrn // 查询出所有学生信息rnrn public String getAllPlan() throws Exception rnrn String hql = "FROM Plan";rnrn list = planService.getList(page, rows);rn toBeJson(list, planService.count(hql).intValue());rnrn System.out.println("page----" + page);rn System.out.println("rows----" + rows);rnrn return SUCCESS;rn rnrn // 转化为Json格式rnrn public void toBeJson(List list, int total) throws Exception rn HttpServletResponse response = ServletActionContext.getResponse();rn HttpServletRequest request = ServletActionContext.getRequest();rnrn jsonObj.put("total", total);// total代表一共有多少数据rn jsonObj.put("list", list);// row是代表显示的页的数据rnrn response.setCharacterEncoding("utf-8");// 指定为utf-8rn response.getWriter().write(jsonObj.toString());// 转化为JSOn格式rnrn System.out.println("jobj.toString()----" + jsonObj.toString());rnrn rnrn public Integer getPlanId() rn return planId;rn rnrn public void setPlanId(Integer planId) rn this.planId = planId;rn rnrn public String getRows() rn return rows;rn rnrn public void setRows(String rows) rn this.rows = rows;rn rnrn public String getPage() rn return page;rn rnrn public void setPage(String page) rn this.page = page;rn rnrn public Date getPlanStartDate() rn return planStartDate;rn rnrn public void setPlanStartDate(Date planStartDate) rn this.planStartDate = planStartDate;rn rnrn public Date getPlanEndDate() rn return planEndDate;rn rnrn public void setPlanEndDate(Date planEndDate) rn this.planEndDate = planEndDate;rn rnrn public Date getPlanSubmitDate() rn return planSubmitDate;rn rnrn public void setPlanSubmitDate(Date planSubmitDate) rn this.planSubmitDate = planSubmitDate;rn rnrn public String getPlanTitle() rn return planTitle;rn rnrn public void setPlanTitle(String planTitle) rn this.planTitle = planTitle;rn rnrn public String getPlanContent() rn return planContent;rn rnrn public void setPlanContent(String planContent) rn this.planContent = planContent;rn rnrn public Integer getPlanState() rn return planState;rn rnrn public void setPlanState(Integer planState) rn this.planState = planState;rn rnrnrnrn这个是jsp: success.jsprn<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>rn<%rnString path = request.getContextPath();rnString basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";rn%>rnrn<%@ taglib prefix="s" uri="/struts-tags" %>rnrnrnrn rn rn rn rn planlistrn rn rn rn rn rn rn rnrnrnrn rn easyui的DataGrid实例rn rn rn rn rn rn 计划标题rn 计划状态rn rn rn rn rn rnrnrnrnstruts.xml配置文件rnrnrnrnrn rn rn rn rn rnrn rn rn rnrnrnrn运行页面显示:rn[img=https://img-bbs.csdn.net/upload/201505/31/1433073547_951275.png][/img]rnrn情况就是后台没有数据显示,但是我的hql语句查到了,麻烦好心的朋友告诉我怎么解决,或者你们有什么源码示例给我rn发一份,rnrnrn
easyui 的 datagrid 在选项卡 tabs 中不显示数据
nn```n nn n n n 添加选项卡n n n n n n n n nn n n
easyui之datagrid为什么后台返回的数据在前台不显示
前台的datagrid如下:rnrn rn rnrn rn rn rn rn rn后台模拟的返回json格式的数据如下:rnpublic class datagrid01 extends HttpServlet rn public void service(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOExceptionrn response.setCharacterEncoding("UTF-8");rn rn [b]String json="['id':'001','name':'admin','password':'password']";[/b]rn PrintWriter out = response.getWriter();rn out.print(json.toString());rn rnrnrn响应中的数据:rn['id':'001','name':'admin','password':'password']rn问题:为什么前台显示不出来'id':'001','name':'admin','password':'password'呢?rn
easyui datagrid 显示时间转换
DateFormat df = new SimpleDateFormat(&quot;yyyy-MM-dd&quot;);//格式化时间   log_qxj.setTime1(df.format(log_qxj.getTime()));
easyUI下datagrid嵌套显示
主要是运用 easyui的方法进行行内嵌套显示,让一行可以显示更多的东西,让一行显示JSON的字符串、从表之类的东西。 下边先看效果图: 接下来说实现过程: (1)在首次加载中添加代码 view: detailview, detailFormatter:function(index,row){ return '&lt;div style="padding:2px"...
JQuery EasyUI 1.3.6 DataGrid显示不了数据
rnJQuery EasyUI 1.3.6 DataGrid显示不了数据,只能显示一个表头,我使用的是JQuery EasyUI 1.3.6的Demo.rn我的系统是windows7 64bit旗舰版.rnrn以前用过这个UI框架,还挺简的。rnrn这个问题我想应该是我的系统问题。但怎么弄都搞不定。要是哪位知道问题所在请一定帮忙。
easyui的datagrid的数据渲染
easyui的datagrid的数据渲染
easyui datagrid显示选择行数据问题
今天使用easyui datagrid发现无论怎么选择行,getSelections得到的数据都不为选择的所有数据。 发现是由于设置了idField属性,所以如果idField没有载入,它会认为是同一条数据,所以发生上面情况。 idField属性删除后就行了。 ...
EasyUI datagrid 没有查询到数据显示提示
EasyUI datagrid 没有查询到数据显示提示,无数据在datagrid显示一行提示 在datagrid在onLoadSuccess方法中加入一下代码: [code=&quot;js&quot;] onLoadSuccess: function(data){ //如果没有数据 if(data.rows.length==0){ var columnLength = Grid....
easyui dataGrid显示对象中集合数据
[img=https://img-bbs.csdn.net/upload/201408/17/1408261747_412871.png][/img],如何将截图中set集合在easyui dataGrid中显示出来???
ASP.NET MVC EasyUI DataGrid显示数据问题
我在用了PageSize :15rnfunction Test() rnrn $('#dg').datagrid(rn title: 'Checkbox selection on DataGrid',rn url: '/Home/GetData',rn method: 'GET', //默认是post,不允许对静态文件访问rn width: '700',rn //iconCls: 'icon-save',rn dataType: 'JSON',rn fitColumns: true,rn rownumbers: true, //是否加行号 rn pagination: true, //是否显式分页 rn pageSize: 15, //页容量,必须和pageList对应起来,否则会报错 rn pageNumber: 1, //默认显示第几页 rn pageList: [15, 30, 45],//分页中下拉选项的数值 rn columns: [[rn field: 'UserName', title: '名称' ,rn field: 'UserPass', title: '密码' rn ]],rn singleSelect: false, //允许选择多行rn selectOnCheck: true,//true勾选会选择行,false勾选不选择行, 1.3以后有此选项rn checkOnSelect: true //true选择行勾选,false选择行不勾选, 1.3以后有此选项rn );rn rn后台rn[HttpGet]rn public JsonResult GetData()rn rn List t1 = new List();rn for (int i = 0; i < 40; i++)rn rn Test test = new Test();rn test.UserName = "Test1";rn test.UserPass = "Test1";rn t1.Add(test);rn rn return Json(t1, JsonRequestBehavior.AllowGet);rn rnrn public class Testrn rn public string UserName get; set; rn public string UserPass get; set; rn rn还是把40条数据都显示出来了 不知道为什么,请教!!!!!!!!!!!!!!请教!!!!!!!!!!!!
easyui datagrid数据批量删除
js页面//批量删除 function deleteStampdef(ctx) { var selRow = $("#dg").datagrid('getSelections'); if (selRow.length == 0) { showError("请至少选择一行数据!"); return false;
easyui datagrid 显示未知结构的数据
控制器方法: public JsonResult SyncGetTmpData(int rows = 0, int page = 0) { try { string where = null; string order = null; if
easyui datagrid 列数据太多显示不完
当某一列的数据太多,在单元格中无法全部显示时,可以采用如下方式: { field : 'cust_telphone', title : '联系电话', width : '10%', }, { field : 'cust_product', title : '关注产品', width : '20%', formatter: function...
Easyui datagrid 显示不了数据 asp.net
//aspx页面rn<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Normal.Master" AutoEventWireup="true" CodeBehind="PanDianHuiZong.aspx.cs" Inherits="MyCompany.MyProject.UIL.ChengBenTJ.PanDianHuiZong" %>rnrn rn rn rn 盘点时间rn 类型rn 名称rn 型号rn 单位rn 盈亏汇总rn rn rn rn rn rn Date From: rn To: rn 库房: rn rn Javarn Crn Basicrn Perlrn Pythonrn rn Searchrn rn rnrnashx页面rn/// rn /// As_PanDianHuiZong 的摘要说明rn /// rn public class As_PanDianHuiZong : IHttpHandlerrn rnrn public void ProcessRequest(HttpContext context)rn rn ChaXun(context);rn rnrn public bool IsReusablern rn getrn rn return false;rn rn rnrn public void ChaXun(HttpContext context)rn rn context.Response.ContentType = "text/plain";rnrn DataSet ds =SFL.SqlHelper.Query(@"SELECTrn a.PanShiJian,rn b.LeiXing,rn b.MingCheng,rn b.XingHao,rn b.DanWei,rn sum(YingKui) as YingKuirnrn FROMrn dbo.Y_PanDian AS arn INNER JOIN dbo.Y_PanDian_MX AS b ON b.ZhuId = a.Id GROUP BY PanShiJian,LeiXing,mingcheng,xinghao,DanWeirn ");rn string strjson = DataSetToJson.DataTable2Json(ds.Tables[0]);rnrnrn context.Response.Write(strjson);rn context.Response.End();rn rn rnrnrn我跟了代码,strjson 有数据 但是前台就是显示不出来.
easyui datagrid绑定数据
后台return json ,前台rn[code=csharp]$.post("/HomeControllers/Excel", params, function (data) //url是你控制器中的action,例如:/控制器/Home)rn var msg = data.msg;rnrn if (msg == "ok") //成功rn alert(data.data);//输出arn rn elsern rn alert(data.data2);//输出brn )[/code]rn怎么绑定到datagrid
DataGrid 不显示数据问题。
[code=VB]rnPrivate Sub Form_Load()rn rn Dim CN As New ADODB.Connectionrn Dim strCN As Stringrn rn strCN = "Driver=SQL Server;server=(local);database=Northwind;uid=sa;pwd="rn rn CN.CursorLocation = adUseClientrn CN.Open strCNrnrn Dim strSQL As Stringrn rn strSQL = "Select 档案序号,姓名 From page"rnrn Dim Rs As New ADODB.Recordsetrn rn Rs.Open strSQL, CN, adOpenKeyset, adLockOptimisticrnrn Set DataGrid1.DataSource = Rsrn DataGrid1.Refreshrnrn Rs.Closern Set Rs = Nothingrn CN.Closern Set CN = Nothingrn rnEnd Subrn[/code]rnrn运行后,DataGrid 像是没做过任何改动一样,只显示两行空白行。。。rn查了N多帖子,没有一点头绪。。。。有请高人相助
DataGrid数据不显示,崩溃
我用DataGrid绑定后数据不显示,字段名称显示出来了,调试看到数据源里有数据。rnrn改成AutoGenerateColumns="true"自动生成字段也一样没有数据。rnrnList catagories=.....;rnDataGrid1.ItemsSource = catagories;
DataGrid控件不显示数据!
如题,我用VC ADO编辑数据库程序rn数据库里面添加了测试数据以后,我调试运行了一次,没问题数据在控件中显示出来了。rn然后我就进入DataGrid属性控制里面 想把列的宽度修改一下,修改以后,我发现再调试的时候,数据在控件中竟然不显示了,这期间我什么也没动啊,我试过添加多条测试数据以后,DataGrid控件中倒是能显示相应的行数,但是每行的格中都是空白的 没有数据,而且列数也不对,只有两列。rnrn也就是说 我如果添加4条测试数据 那么DataGrid中会相应出现4行表格,但是都是空的。rnrn这是怎么回事啊?本来第一次运行的时候还好好的,就是想设置列宽的时候 修改了一下DataGrid控件LayOut选项卡下的width数据,然后就不行了 再改回去问题依旧rnrn我是初学者 这个问题也比较怪 不知道该贴那段代码上来 大家给看看!
DataGrid不显示数据问题
DataGrid绑定好了数据,可是从数据库里找完了付给DataGrid,DataGrid不显示??还是我写错了?rnrn Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loadrn '在此处放置初始化页的用户代码rn If Not IsPostBack Thenrn If Session("U_name") = "" Thenrn Response.Write("<" + "script language=javascript>alert(""您尚未登陆![错误代码:001000]"");")rn Response.Write("window.self.location.href=""login.aspx"";")rn Response.End()rn Elsern dealtree()rn End Ifrn End Ifrn End Subrn Sub dealtree()rn Dim type = Request.QueryString("type")rn Dim priority = Request.QueryString("priority")rn rn If priority = "" Thenrn get_tree(0, type)rn Elsern get_tree(priority, type)rn End Ifrn End Subrnrn Sub get_tree(ByVal priority As String, ByVal type As String)rn mycon = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings("sql_path"))rn Dim mycmd As SqlClient.SqlDataAdapterrnrn If priority = "0" Thenrn mycmd = New SqlClient.SqlDataAdapter("select a.notice_id,title,content,file_names,add_date from notice_base as a,notice_file as b where a.notice_id=b.notice_id and type= '" & type & "' order by add_date desc", mycon)rn Elsern mycmd = New SqlClient.SqlDataAdapter("select a.notice_id,title,content,file_names,add_date from notice_base as a,notice_file as b where a.notice_id=b.notice_id and type= '" & type & "' and priority= '" & priority & "' order by add_date desc", mycon)rn End Ifrn Dim dt As DataSet = New DataSetrn mycmd.Fill(dt, "notice_base")rn DataGrid1.DataSource = dt.Tables("notice_base").DefaultViewrn DataGrid1.DataBind()rn mycon.Close()rn End Subrn