How to find the last row in jqgrid

2019-03-05 10:54发布

Currently i'm working on the jqgrid, where i have to find out the last row and implement the ctrl down functionality. But currently i could not able to get the last row.

Needed some one help here.

Thanks in advance

标签: jquery jqgrid
2条回答
疯言疯语
2楼-- · 2019-03-05 11:39

If the grid id is for example list then the following expression should return you the last row:

$("#list").find(">tbody>tr.jqgrow:last");

or

$("#list").find(">tbody>tr.jqgrow").filter(":last");

One more, event better, way to get the last row is the following

var rows = $("#list")[0].rows,
    lastRowDOM = rows[rows.length-1];

It uses the rows collection of DOM representation of <table>. The value $(lastRowDOM) will the same as $("#list").find(">tbody>tr.jqgrow").filter(":last").

查看更多
放荡不羁爱自由
3楼-- · 2019-03-05 11:48

For 4.6.0 version above

$("#list tbody:first tr:nth-child(2)").attr('id');

For me working fine using 4.6.0 version

查看更多
登录 后发表回答