请参考这个示例, 其中有移动到顶部的代码
https://www.grapecity.com/wijmo/ ... ge#demo_source_name
- // set top cell
- document.getElementById('scrollToTop').addEventListener('click', function () {
- if (true) {
- //
- // get cell rect, adjust scrollPosition.y to bring it to the top
- var rc = theGrid.cells.getCellBoundingRect(100, 0, true);
- theGrid.scrollPosition = new wjCore.Point(theGrid.scrollPosition.x, -rc.top);
- //
- }
- else {
- //
- // simpler but less efficient (requires a timeOut)
- theGrid.scrollIntoView(theGrid.rows.length - 1, -1);
- setTimeout(function () {
- theGrid.scrollIntoView(100, -1);
- });
- }
- });
复制代码 |