0

我有一个这样的网格:

//Barang
//label_name
var label_name = ["No", "Part Number", "Part Name", "Price", "Pallete", "UOM", "QTY", "Total", "Action"];


var getLabel = $("#label_name").val();
var arr_label = getLabel.split(',');
var n = arr_label;
for(i=0;i<n.length;i++){
    //label_name.push(n[i]);
}
//label_name.push("Total Demand", "Avarage Demand", "Nilai Total Pengguna Uang", "HIT", "Nilai Persediaan(Value*HIT)");


//content_name
var content_name = [
    {name:'no', index:'no', width:50, align:"right", editable:false, editoptions:{readonly:true}, sorttype:'int', searchoptions:{sopt:['eq']}, search:false},
    {name:'part_number', index:'part_number', width:200, sortable:false, editable:true, searchoptions:{sopt:['eq']}},
    {name:'part_name', index:'part_name', width:200, editable:true, searchoptions:{sopt:['eq']}},
    {name:'price', index:'price', width:150, align:"right", editable:true, editrules:{number:true}, sorttype:'number', formatter:'number', searchoptions:{sopt:['eq']}},
    {name:'pallete', index:'pallete', width:100, sortable:false, editable:true, searchoptions:{sopt:['eq']}, search:false},
    {name:'uom', index:'uom', width:100, editable:true, searchoptions:{sopt:['eq']}, search:false},
    {name:'qty', index:'qty', width:100, editable:true, searchoptions:{sopt:['eq']}, search:false},
    {name:'total', index:'total', width:100, editable:true, searchoptions:{sopt:['eq']}, search:false},
    {name:'action', index:'action', width:100, editable:true, searchoptions:{sopt:['eq']}, search:false}
];


var getLabel = $("#label_name").val();
var arr_label = getLabel.split(',');
var n = arr_label;
for(i=0;i<n.length;i++){
    //content_name.push({name:n[i], index:n[i], width:45, align:"right", sortable:false, editable:false});
}
/*
content_name.push(
    {name:'total_demand', index:'total_demand', width:50, align:"right", sortable:false, editable:false},
    {name:'average_demand', index:'average_demand', width:50, align:"right", sortable:false, editable:false},
    {name:'ntpu', index:'ntpu', width:80, align:"right", sortable:false, editable:false, formatter:'number'},
    {name:'hit', index:'hit', width:30, align:"right", sortable:false, editable:false},
    {name:'nilai_persediaan', index:'nilai_persediaan', width:80, align:"right", sortable:false, editable:false, formatter:'number'}
);
*/

jQuery("#barang").jqGrid({
    url:'load_barang.php',
    datatype: "json",
    colNames:label_name,
    colModel:content_name,
    rowNum:10,
    rowTotal: 50,
    rowList:[10,20,30],
    pager: '#pbarang',
    sortname: 'id',
    loadonce: true,
    viewrecords: true,
    sortorder: "desc",
    editurl: 'server.php', // this is dummy existing url
    caption:"Modul Barang",
    shrinkToFit: false,
    height: 'auto'
});
//jQuery("#barang").jqGrid('navGrid','#pbarang',{});
jQuery("#barang").jqGrid('navGrid','#pbarang',{edit:false,add:false,del:false});
jQuery("#barang").jqGrid('gridResize',{minWidth:350,maxWidth:true,minHeight:80, maxHeight:true});
jQuery("#barang").jqGrid('hideCol',["total"]);

//Resizable Grid
$( "#barang" ).resizable({
    grid: 50
});

//Merge
jQuery("#barang").jqGrid('setGroupHeaders', {
  useColSpanStyle: true, 
  groupHeaders:[
    {startColumnName: n[0], numberOfColumns: n.length, titleText: '<center>Demand</center>'}
    //{startColumnName: 'closed', numberOfColumns: 2, titleText: 'Shiping'}
  ] 
});

//Hide and Show
jQuery("#hcg").click( function() {
    jQuery("#barang").jqGrid('hideCol',["total"]);
});
jQuery("#scg").click( function() {
    jQuery("#barang").jqGrid('showCol',["total"]);
});

我已经$("#"+rowid).hide()根据这个答案尝试了这段代码 - > jqgrid hide row inside grid

但它在我的网格中不起作用

请帮我。谢谢。

4

1 回答 1

0

尝试这个:

$("#row_id","#barang").css({display:"none"})
于 2013-07-17T06:50:38.580 回答