如何在JQgrid中使用鼠标悬停获取当前行数?

时间:2014-01-27 11:44:32

标签: jqgrid row

我想通过鼠标悬停获取行数。这是我的代码:

    gridComplete: function() {
                var myGrid = $('#list2'),
                x = myGrid.jqGrid('getGridParam', 'reccount');
//here I get the total number of rows in jqgrid


                $('#list2 #popupData').mouseover(function(e) {
                    //here I dont know what to write and i how to get the current row number, not the ID 
                });
            },

THX

1 个答案:

答案 0 :(得分:0)

一般情况下,这会起作用,但我认为在启用分页时效果不佳。

    beforeSelectRow:function(rowid,e) 
    {
    alert("Row [" + rowid + "] is row number [" + $("#" + rowid)[0].rowIndex + "]");
        return false;
    },

但确切的代码取决于#popupData是什么。你想找到所选行的行号吗?

更新:根据评论中的讨论,这是如何处理,更改您想要的任何显示机制的警报

$("#popupdata").mouseover(function() {
     alert( $(this).parents('tr')[0].rowIndex);
});