当前位置: 动力学知识库 > 问答 > 编程问答 >

jquery - show only specific row in jqGrid

问题描述:

I want to show only specific row in my jqGrid table. I want to set a condition according to row ID. can any one have any solution for this?

网友答案:

You can use $("#"+rowid).hide() or $("#"+$.jgrid.jqID(rowid)).hide() in case of the row id can has some special characters (see the old answer). You can hide the rows inside of the loadComplete event for example. In case of usage of treegrid you should take in the consideration that in the way you should hide top level (level:0) of the nodes. One more option which you has is to delete the nodes with respect of delRowData or delTreeNode instead of hiding.

UPDATED: Sorry, but what you probably try to do is just to display a tree grid. The code should be something like this

jQuery(function () {
    jQuery("#tree").jqGrid({
        url: 'manish987654321.xml',
        colNames: ['Inv No', 'Column 1', 'Column 2'],
        colModel: [
            { name: 'id', index: 'id', width: 55, hidden: true },
            { name: 'column1', index: 'column1', width: 150 },
            { name: 'column2', index: 'column2', width: 100 }
        ],
        rowNum: 10000,
        viewrecords: true,
        height: "auto",
        caption: "Invoice Header",
        treeGrid: true,
        treeGridModel: 'adjacency',
        treedatatype: "local",
        ExpandColClick: true,
        ExpandColumn: 'column1'
    });
});

Which you can see live here. It display the tree grid which can be expanded to

分享给朋友:
您可能感兴趣的文章:
随机阅读: