87,907
社区成员
发帖
与我相关
我的任务
分享
$(function() {
var lastsel;
var $grid = $('#emailSetting');
function resizeWindow() {
var pageHeight, pageWidth;
if ($.browser.msie) {
pageHeight = document.compatMode == "CSS1Compat" ? document.documentElement.clientHeight
: document.body.clientHeight;
pageWidth = document.compatMode == "CSS1Compat" ? document.documentElement.clientWidth
: document.body.clientWidth;
$grid.setGridHeight(pageHeight * 0.4);
$grid.setGridWidth(pageWidth * 0.998, true);
} else {
pageHeight = self.innerHeight;
pageWidth = self.innerWidth;
$grid.setGridHeight(pageHeight * 0.4);
$grid.setGridWidth(pageWidth * 0.998, true);
}
}
$(window).resize(function() {
resizeWindow();
});
$grid.jqGrid( {
datatype : "local",
height : 330,
width : 500,
colNames : [ '用户名', '登录名', '密码', '状态','用户类型', '联系方式', '备注', '创建时间'],
colModel : [ {
name : 'username',
index : 'username',
width : "10%",
editable : true
}, {
name : 'loginname',
index : 'loginname',
width : "10%",
editable : true
}, {
name : 'password',
index : 'password',
width : "10%",
editable : true
}, {
name : 'status',
index : 'status',
width : "6%",
editable : true,
edittype : 'checkbox',
editoptions : {
value : "允许:禁止"
}
}, {
name : 'type',
index : 'type',
width : "6%",
editable : true
},{
name : 'contact',
index : 'contact',
width : "6%",
editable : true
}, {
name : 'remark',
index : 'remark',
width : "6%",
editable : true
}, {
name : 'createtime',
index : 'createtime',
width : "6%",
editable : true
}],
sortname : 'name',
sortorder : 'asc',
viewrecords : true,
rowNum : 5,
rowList : [ 10, 20, 30 ],
pager : "#pager",
caption : "用户管理"
});
resizeWindow();//初始化表格大小
$.ajax({
url: "./userMgmtQueryAll.action",
type: "post",
datatype: "json",
success: function(data){ //处理actin返回的数组
alert("我敢保证,你现在用的是演示一"+data);
for ( var i = 0; i <= data.length; i++){
$grid.jqGrid('addRowData', i + 1, data[i]);
}
}
});
{"userMgmtList":[{"contact":"123456789","createtime":"2011-04-20T13:21:16","loginname":"admin","password":"admin","remark":"系统管理员","status":1,"type":1,"username":"admin"},{"contact":"111111111","createtime":"2011-04-20T13:23:40","loginname":"1","password":"1",
"remark":"子系统管理员","status":1,"type":1,"username":"11111"},
{"contact":"22222222","createtime":"2011-04-20T13:24:25","loginname":"2","password":"2","remark":"子系统操作员","status":0,"type":0,"username":"22222"}]}