jqgrid动态显示,隐藏指定列

 
jQuery(function($) {
    var grid1 = $.extend(true, {}, BaseJqGrid, {
        resizeHandle: "#resizeH",
        pager         : "#pager", // 分页工具栏
        datatype     : "local",  // 点开页面不自动查询
                pager: null,//无分页工具栏
                url         : _path + "/jczdgl/rwjczdsq_cxRdex.html",
        height        : "300px",
        colModel : [ 
            {label:'时间',name:'sksj', index: 'sksj',width:150,align:"center",sortable:false},
            {label:'地点',name:'jxdd', index: 'jxdd',width:150,align:"center",sortable:false},
        ]
    });
    
    
    //加载表格
    $("#tabGrid").loadJqGrid(grid1);
 
    if(jQuery("#sksj").val()==0){
        $("#tabGrid").setGridParam().hideCol("sksj");
    }
    
    if(jQuery("#skdd").val()==0){
        $("#tabGrid").setGridParam().hideCol("jxdd");

    $("#tabGrid").setGridParam().hideCol("sksj");
    $("#tabGrid").setGridParam().showCol("sksj");  

 

posted on 2024-06-08 09:20  _一级菜鸟  阅读(46)  评论(0编辑  收藏  举报