dGrid table 以编程方式水平滚动

dGrid table scroll horizontally programmatically

dGrid 中是否有一种方法可以让您滚动到 table 中的特定列,我有一个 table 可以水平滚动,我想知道是否可以这样做类似于:

myGrid.scrollToColumn(someColumnToScrollTo);

我知道我可以垂直滚动到某行,是否有类似的东西可以满足我的需要?

正如 kfranqueiro(Dojo 1.x 提交者和 dgrid 维护者)所说:

https://github.com/SitePen/dgrid/issues/360

Firstly, there is a scrollTo method on dgrid instances, which you can pass an object with x or y properties to scroll in a platform-agnostic manner

还是他,他在这里使用那个功能:

https://github.com/SitePen/dgrid/issues/1279

grid.scrollTo({ y: index * grid.get('rowHeight') })

你需要传递 x 而不是 y 和你需要的偏移量而不是索引 * grid.get('rowHeight')