示例一:
1.页面:
<script type="text/javascript">
Ext.onReady(function() {
var EasyGrid = new Ext.ux.EasyGrid({
//title: 'Grid扩展',
autoWidth: true,
height:500,
//headers: [['名称',''],['开始时间',''],['结ddd时间',''],['创建用户',''],['编号','']], //列名 false为隐藏该列
fields: ['processInstanceId','Notice_id','startNotice_user','Notice_time','workFlow_name'], //列对应字段名
//data:'{totalProperty:1,root:[{"id":"FaWenShenPi-1","name":"发文审批流程","startTime":"2010-11-08","endTime":"2010-11-30","createUser":"admin"}]}',
renderTo: 'easyGrid',
cm:new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{header:'名称',dataIndex:'workFlow_name'},
{header:'知会用户',dataIndex:'startNotice_user'},
{header:'知会时间',dataIndex:'Notice_time'},
{header:'表单数据',dataIndex:'processInstanceId'},
{header:'知会记录',dataIndex:'processInstanceId'}
]),
tbar: new Ext.Toolbar([
'-',
{xtype : "tbfill"
},
'-'])
});
});
</script>
</head>
<body bgcolor="#F9F9F9" >
<div id="easyGrid" style="margin-left:20px;"></div>
</body>
2.
findNoticeListByLoginuser.action:
分页参数
String starString = this.getRequest().getParameter("start");
String limitString = this.getRequest().getParameter("limit");
String result = "[";
String t = "";
List noticeList = flowModle.findNoticeListByTouser(umInfo.getUmid(),start,limit);
t += "{"
+ "\"dep_name\":\" " + departmentInfo.getName() + "\","
+ "\"dep_type\":\"" + type+"\","
+ "\"dep_grade\":\"" + departmentInfo.getGrade()+"\","
+ "\"dep_status\":\"" + stateString+"\","
+ "\"dep_id\":\"" + departmentInfo.getDid()+"\","
+ "\"dep_id_flow\":\"" + departmentInfo.getDid()+"\","
+ "\"dep_id_operation\":\""+departmentInfo.getDid()+ "\""
+"},";
if(t!=null && !"".equals(t)){
t = t.charAt(t.length() - 1) == ',' ? t.substring(0,t.length() - 1):t;
}
result = result + t + "]";
String json = "{totalProperty:" + count + ",root:"
+ result.replaceAll("\n", "") + "}";
outString(json);
JSON:
totalProperty:1(一共有多少条记录)
{totalProperty:1,root:[{"processInstanceId":"FeiYongBaoXiao-1","Notice_id":"7","startNotice_user":"qh","Notice_time":"2010-12-13","workFlow_name":"费用报销流程"}]}
示例二:
<html>
<head>
<title>listqh.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
href="/dyzc/scripts/ext320/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/dyzc/scripts/ext320/resources/css/all.css" />
<link href="/dyzc/resources/css/Global.css" type="text/css"
rel="stylesheet" />
<script type="text/javascript"
src="/dyzc/scripts/ext320/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/dyzc/scripts/ext320/ext-all.js"></script>
<script type="text/javascript"
src="/dyzc/scripts/ext320/ext-lang-zh_CN.js"></script>
<link rel="stylesheet" type="text/css"
href="/dyzc/resources/css/inputHighlight.css" />
<script type="text/javascript" src="/dyzc/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dyzc/scripts/MultiSelect.js"></script>
<script type="text/javascript" src="/dyzc/scripts/ItemSelector.js"></script>
<script type="text/javascript" src="/dyzc/scripts/ExtGrid02.js"></script>
</head>
<script type="text/javascript">
var hdid = 0;
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'/dyzc/queryDepartInfoqh.action'}),
reader: new Ext.data.JsonReader({
totalProperty: 'totalProperty',
root: 'root'
}, [
{name: 'dep_name'},
{name: 'dep_type'},
{name: 'dep_grade'},
{name: 'dep_status'},
{name: 'dep_id'},
{name: 'dep_id_flow'},
{name: 'dep_id_operation'}
])
});
function next(QH){
store.reload({
params : {
start : 0,
limit : 10,
hdid :QH
}
});
hdid = QH;
};
function deleteDep (value){
var ID=value;
Ext.Msg.confirm('提示信息','你确定要彻底删除吗?',function(btn){
if(btn=='yes'){
Ext.Ajax.request({
url: '/dyzc/deleteDepartInfoqh.action',
params:{
did:ID
},
success: function(response, options) {
var rs = response.responseText;
if(rs==1) {
Ext.Msg.alert('提示信息','删除成功!');
location.replace('/dyzc/admin/listqh.html');
} else {
Ext.Msg.alert('提示信息','删除失败!');
}
}
});
}
});
};
Ext.onReady(function() {
function renderForm(value, cellmeta, record, rowIndex, columnIndex, store) {
var state = record.data.dep_status;
if(state == '启用'){
return '<a href="/dyzc/initDepartInfo.action?did='+value+'" target="_self">编辑</a> <a href="/dyzc/detailDepartInfo.action?did='+value+'" target="_self" >详细</a>';
}else{
return '<a href="/dyzc/initDepartInfo.action?did='+value+'" target="_self">编辑</a> <a href="/dyzc/detailDepartInfo.action?did='+value+'" target="_self" >详细</a> <a href="#" onclick="deleteDep(\''+value+'\')">删除</a>';
}
};
function nextDep(value){
return '<div style="cursor:pointer; color:#537DB0;" onclick="next(\''+value+'\')">下级部门</div>';
}
var searchForm = new Ext.form.FormPanel({
labelAlign:'right',
labelWidth:80,
autoHeight:true,
bodyStyle:'padding-top:20px;margin-left:60px;',
frame:true,
region:'north',
items:[ {xtype:'textfield',fieldLabel:'部门状态',id:'status'},
{xtype:'textfield',fieldLabel:'部门类型',id:'type'},
{xtype:'textfield',fieldLabel:'部门级别',id:'grade'},
{xtype:'textfield',fieldLabel:'部门名称',id:'depname'}
],
buttons:[{
text:'查询',
cls:'winBtn',
width:73,
handler:function(){
store.reload({
params : {
start : 0,
limit : 10,
status : Ext.get('status').dom.value,
type : Ext.get('type').dom.value,
grade : Ext.get('grade').dom.value,
depname : Ext.get('depname').dom.value
}
});
}
},{
text:'取消',
cls:'winBtn',
width:73,
handler:function(){
winSearch.hide();
}
}],
keys:[{
key:Ext.EventObject.ENTER,
fn:function(){
store.reload({
params : {
start : 0,
limit : 10,
name : Ext.get('sname').dom.value,
stime01 : Ext.get('stime01').dom.value,
stime02 : Ext.get('stime02').dom.value,
activityname : Ext.get('sphone').dom.value
}
});
},
scope:this
}]
});
var winSearch = new Ext.Window({
title:'请输入查询条件',
width:400,
id:'winSearch',
layout:'fit',
closeAction:'hide',
collapsible:true,
animateTarget:'search',
animCollapse:true,
constrain:true,
autoHeight:true,
items:[searchForm]
});
var cm = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
new Ext.grid.CheckboxSelectionModel(),
{header:'部门名称',dataIndex:'dep_name'},
{header:'部门类型',dataIndex:'dep_type'},
{header:'部门级别',dataIndex:'dep_grade'},
{header:'部门状态',dataIndex:'dep_status'},
{header:'下级部门',dataIndex:'dep_id',renderer:nextDep},
{header:'流程列表',dataIndex:'dep_id_flow'},
{header:'操作',dataIndex:'dep_id_operation',renderer:renderForm}
])
store.load({params:{start:0,limit:10,hdid:0}});
var EasyGrid = new Ext.ux.EasyGrid({
title: '系统管理>>部门管理',
autoWidth: true,
id:'egridpanel',
region:'center',
height:500,
store:store,
sm:new Ext.grid.CheckboxSelectionModel(),
cm:cm,
tbar: new Ext.Toolbar([
'-',
{xtype : "tbfill"
},{
text:'添 加',
iconCls: 'add',
handler:function(){
location.replace('/dyzc/initDepartInfo.action?hdid='+hdid);
}
},
'-',
{
text:'查询',
id:'search',
iconCls: 'search',
handler:function(){
winSearch.show();
}
}])
});
var view = new Ext.Viewport({
layout:'border',
style:'background-color:#FFFFFF;',
items:[{
region:'center',
layout:'border',
border:false,
bodyBorder:false,
items:[EasyGrid]
}]
});
});
</script>
<body>
</body>
</html>