如何在网格底部设置默认滚动 WebDataGrid

How to set by default scroll for WebDataGrid at the bottom of the grid

目前我们设置scrolltop如下:

   webGrid.ScrollTop = dt.Rows.Count * 30;

其中 dt 包含绑定到 webgrid 的总数据。但是当数据表中存在大量数据并且设置 scrolltop 属性 后,webGrid.Rows.Count 正在减少,这会导致问题。请帮助设置 webgrid 的滚动底部而不减少 webGrid 行数

您提到行数减少,这是否意味着您正在使用虚拟滚动,并且最初并非所有行都加载?

至于你的问题,在 客户端 上有很简单的方法来实现它。您可以获得滚动容器高度 - $("#WebDataGrid1 table[role='grid']") .. 并使用 scrollTop 滚动到容器底部。

var height = parseInt($("#WebDataGrid1 table[role='grid']").css("height"));
ig_controls.WebDataGrid1._container.scrollTop = height;