난 당신이 그리드에 대한 참조를 얻고 그리드 $viewport.scrolltop
메서드를 호출해야 할 것 같아요. 참고 : 나는 이것을 테스트하지 않았고, 비슷한 것을 기반으로 작성했습니다.
plugins: [{
onGridInit: function (g) {
// maybe add a method to your view model
viewModel.scrollTo = function (index, key) { // index of item in filter data, key is something i made up
if (index > g.filteredData().length - 8) { // 8 is the default excess_rows value in kogrid
g.$viewport.scrollTop(g.$viewport.scrollTop() + (g.config.rowHeight * index));
}
// if you want to select the row (set time out because ko grid dynamically creates the rows rendered in the grid)
setTimeout(function() {
var i = ko.utils.arrayFirst(g.renderedRows(), function (row) {
// some function that finds the entity
return row.entity.key === key;
});
if (i) {
g.selectionService.ChangeSelection(i) // this will select the row
}
}, 100);
}// assume self is your view model
}
}]