easyDemo1.jsp页面代码如下:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>easyDemo1.jsp</title> <link rel="stylesheet" type="text/css" href="jquery-easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="jquery-easyui/themes/icon.css"> <script type="text/javascript" src="jquery-easyui/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="jquery-easyui/jquery.easyui.min.js"></script> <script type="text/javascript" src="jslib/easyDemo.js"></script> <script type="text/javascript"> $(function(){ $('#tt').datagrid({ title:'datagrid小例子', iconCls:'icon-ok', width:500, height:320, pageSize:5, pageList:[5,10,15,20], nowrap:false, striped: true, collapsible:true, url:'easyAction.action', loadMsg:'数据装载中......', sortName:'code', sortOrder:'desc', remoteSort:false, frozenColumns:[[ {field:'ck',checkbox:true} ]], columns:[[ {title:'学号',field:'id',width:'50',rowspan:2,align:'center'}, {title:'姓名',field:'name',width:'60',rowspan:2,align:'center'}, {title:'性别',field:'sex',width:'50',rowspan:2,align:'center'}, {title:'年龄',field:'age',width:'50',rowspan:2,align:'center'}, {title:'出生日期',field:'birthday',width:'120',rowspan:2,align:'center'}, {title:'班级',field:'className',width:'100',rowspan:2,align:'center'} ]], pagination:true, rownumbers:true }); $('#tt').datagrid('getPager').pagination({ displayMsg:'当前显示从{from}到{to}共{total}记录', onBeforeRefresh:function(pageNumber, pageSize){ $(this).pagination('loading'); alert('pageNumber:'+pageNumber+',pageSize:'+pageSize); $(this).pagination('loaded'); }, }); //$('#tt').datagrid({url:'easyAction.action'}); }); </script> </head> <body> <a href="javascript:void(0)" onclick="verify()" class="easyui-linkbutton">测试josn数据</a> <h2><b>测试easyui的DataGrid</b></h2> <table id="tt"> </table> </body> </html>
|