Search code examples
c#asp.netjqgridjqgrid-asp.net

Get row hieght from JQGrid


I understand I can set the row height of a JQGrid by doing the below.

$("#list").jqGrid({

loadComplete: function() {
    var grid = $("#list"),
        ids = grid.getDataIDs();

    for (var i = 0; i < ids.length; i++) {
        grid.setRowData(ids[i], false, { height : 20 + (i * 2) });
    }
}
});

I was just wondering if there a similar method I can use to loop through the grid and “GET” the row height for each row?

Thanks in advance,


Solution

  • You have the id of the each row - then it is easy to loop and do

    $("#list").jqGrid({
        loadComplete : function() {
            var grid = $("#list"), rowheight={},
            ids = grid.getDataIDs();
    
            for (var i = 0; i < ids.length; i++) {
                rowheight[ids[i]] = $("#"+ ids[i]).height();
            }
        }
    });