开发者

jqGrid hide row when table is created

I have a jqgrid table and I would like to hide rows based on a condition. I have been trying to hide the row in th开发者_如何转开发e gridComplete event but that does not seem to work. My gridComplete event looks like this:

gridComplete: function() {
        for(i = 0; i < rowsToHide.length; i++) {
            $("#" + rowsToHide[i], "#myTable").hide();
        }
}

I'm not sure if I can technically hide the row like this or if there is another way I need to do this. I'm basically looking to hide a set of rows based on some criteria once I have the data set returned from the server. I would like to hide these rows as soon as I load my jqGrid table.

Thanks in advance for your help.


There is no out of the box support for hiding rows, however the solution you posted should work but has some tiny issues. The fact it isn't working could be because of the typo you made: rowToHide[i] -> rowsToHide[i] or the row ID's in the array are wrong. Check your array for that, also check if the function is being called.

The issues are that when you hide rows and the height of your grid is set to auto it will not adjust the size properly, also if you show rownumbers in your grid they are not sequential anymore. This problems can be fixed manually.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜