如何转到 jqgrid 中 table 的最后一列?没有滚动到最后

How to go to last column of a table in jqgrid? without scrolling to the end

在许多网站中,当我们向下滚动时,会出现一个按钮。它说 'Top'。当我们点击它时,它会将我们带到页面顶部。

我的问题是:
我想在 table 中具有类似的功能,但是是水平的。 让我解释一下,我的应用程序中有一个 table,它有 100 多列。因此,如果我想转到最后一列,则必须水平滚动直到到达最后一列。我正在使用 Jqgrid。 jqgrid 中是否有任何实现只需单击一个按钮或其他东西就可以将我们带到最后一列?有人试过吗?

这是一个可能的解决方案:https://jsfiddle.net/99x50s2s/38/

将自定义按钮添加到您的 jqgrid,如 fiddler 中所示,获取 'ui-jqgrid-bdiv' class 的宽度并在按钮单击事件中向右滚动,

.jqGrid('navButtonAdd', '#sg1' + "_toppager", {
        caption: "See last column",
        title: "Last Column",
        onClickButton: function () {
            $('.ui-jqgrid-bdiv').animate({
                scrollLeft: $(this).width()
            }, 'slow');
        }
    });