jquery datatable如何定位到指定行上?

2025-03-24 19:19:46
推荐回答(1个)
回答1:

var boxTop = $("tbody").find("tr").eq(0).offset().top; //第一行距离顶部的距离
var currentRowTop = $("tbody").find("tr").eq(10).offset().top; //指定行到顶部的距离
$(".dataTables_scrollBody").scrollTop(currentRowTop - boxTop); //滚动到指定行位置