常规的jqgrid格式:
// 加载JQGRID
$("#grid").jqGrid({
url:'release!findReleaseList.do',
datatype: 'json',
mtype: 'POST',
colNames:['序号','Release名称','完成日期'],
colModel :[
{name:'id',index:'id',hidden:true,align:'center'},
{name:'title',index:'title',width:'350px',align:'left'},
{name:'finishtime',index:'finishtime',width:'85px',align:'center'},
],
pager: '#pager',
rowNum:15,
rowList:[15,20,30],
sortname: 'finishtime',
sortorder: 'desc',
autowidth: true,
height:'auto',
multiselect:true,
jqModal:true,
viewrecords: true
});
============================================================================================================================
显示固定文字传递id的超链接:
colModel :[
{
label : '执行信息',
name : 'id',
index : 'id',
width : 75,
formatter:function(cellvalue, options, rowObject){
if(cellvalue != "合计:"){
return "<a onclick=\"showExecutionInfo("+cellvalue+")\" style='text-decoration:underline;color:blue;cursor:pointer;'>执行信息</a>";
}else{
return cellvalue;
}
}
}
]
//根据传来的id弹出对话框
function showExecutionInfo(id){
$("#hiddenExecutionInfo").dialog({
width : 1200,
height : 470,
resizable : false,
modal : true, // 这里就是控制弹出为模态
position: [80, 40],
title:"订单执行信息",
close:function(event,ui){
$(this).dialog("destroy");
}
}).dialog("open");
$("#hiddenExecutionInfo").load("/clap-appweb/rtran/executionInfo.do?orderId="+id);
}
============================================================================================================================
显示字段值传递当前值的超链接:
colModel :[
{
label : '货主订单号',
name : 'ownerOrderNo',
index : 'ownerOrderNo',
width : 95,
formatter:function(cellvalue, options, rowObject){
return "<a onclick=\"showOrderDetail("+options.rowId+")\" style='text-decoration:underline;color:blue;cursor:pointer;'>"+cellvalue+"</a>";
}
}
]
//根据传来的参数打开新的标签页面
function showOrderDetail(orderId){
$("#"+frame).load("/clap-appweb/order/orderEditNew.do?id="+orderId+"&fsmMenuId="+$("#fsmMenuId").val()+"&viewDetailType=orderQueryAll");
}
============================================================================================================================
更换字段值:
colModel :[
{name:'clazz',index:'clazz',width:'85px',align:'center',
formatter: function(value,row,index){
if(value){
if(value=='1'){
return '功能新增';
}else if(value=='2'){
return '功能提升';
}else if(value=='3'){
return 'BUG解决';
}else if(value=='4'){
return '数据库结构修改';
}
}
}
}
]