简体   繁体   中英

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM