jqgrid常用格式

常规的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 '数据库结构修改';
               }
            }
        }
    }
]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值