jeecg平台testDatagrid

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker,autocomplete"></t:base>
<body>
<table id="dg"></table>
</body>
<script type="text/javascript">
/*var jsondata1='{"total":1,"rows":[{"username":"001","password":"001"},{"username":"002","password":"002"},{"username":"002","password":"002"}]}';
var data = $.parseJSON(jsondata1); //json格式化
alert(jsondata1);//没毛病*/ $(document).ready(function(){
$("#dg").datagrid({
title: "用户信息列表",
width: 700,
height: 'auto',
striped: true,
rownumbers: true,
singleSelect: true,
nowrap: true,
pagination: true,
columns:[[
{field:"username",title:"用户名",width:100},
{field:"password",title:"密码",width:100}
]]
}) $.ajax({
type:"POST", //请求方式
url:"testController.do?returnData", //请求路径
cache: false,
data:"", //传参
dataType: 'json', //返回值类型
success:function(result){
var jsondata2 = result;
var data = $.parseJSON(jsondata2); //json格式化
alert(jsondata2);//未初始化
$("#dg").datagrid('loadData', data);//加载数据,不加表格数据不会显示 },
error:function(){
alert("error");
}
}); });
</script>
上一篇:NHibernate初步使用


下一篇:flask再学习-思考之怎么从数据库中查询数据在页面展示!