jqgrid封装

<%--初始化表格列表组件 --%>
function initGrid() {
<%--#hostComputerId获取DIV id--%>
$('#hostComputerId').initBsGrid(
{
url: '${pageContext.request.contextPath}/accountManger/queryAccount!searchAccount.action?CSRFToken_HW=${randomStr_HW }&nav=nav3',
multiselect: false,
loadComplete: afterLoadEvent,
sortorder: "desc",
sortname: "createtime",
viewrecords : true,
colNames:["","<s:text name='bs.account.username'/>","<s:text name='bs.account.status'/>",
"<s:text name='bs.account.email'/>","<s:text name='bs.account.createtime'/>",
"<s:text name='bs.common.operate'/>"
],
colModel:
[
{name:'userid',index:'userid', hidden:true},
{name:'username',index:'username',align:'left',width:150},
{name:'status',index:'status', width:80, align:'center',formatter:function(cellval, opts)
{
<%--根据状态值判断,显示不同字体颜色--%>
if(cellval == "<s:text name='bs.account.statusOK'/>"){
return "<s:text name='bs.account.statusOK'/>";
}
if(cellval == "<s:text name='bs.account.statusFal'/>"){
return "<span style='color:red'><s:text name='bs.account.statusFal'/></span>";
}
}},
{name:'email',index:'email', width:150},
{name:'createtime',index:'createtime', width:190, align:"center",sorttype:"date"},
{name:'operator',index:'operator', width:100,sortable:false,resizable:false,fixed:true,
formatter:function(cellval, opts){
return "<center title=' '>"
+"<div id='"+opts.rowId+"' title='' class='menu_div' style='border:solid blue 0px'>"
+"<a class='menu_oper' style='cursor:pointer;text-decoration:none'>"
+"<s:text name='bs.spec.list.operaper'/> <img src='${pageContext.request.contextPath}/resources/images/sh_zy_jt.png' />"
+"</a><div></center>";
}
}
]
});
}


<%--分页 --%>
function doPagerAction(pageIndex)
{
$("#hostComputerId").trigger("reloadGrid",[{page:pageIndex}]);
}

<%--查询 --%>
function doSearchAction()
{
var text = $("#condition").val();
$("#hostComputerId").jqGrid("setGridParam",{url:encodeURI(encodeURI("${pageContext.request.contextPath}/accountManger/queryAccount!searchAccount.action?CSRFToken_HW=${randomStr_HW }&nav=nav3"+
"&condition=" + text)),page:1}).trigger("reloadGrid");
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值