[Index.cshtml]
<input id="textbox" type="text" name="value" />
<button id="next">Click to navigate </button>
@(Html.EJ().Grid<MVCSampleBrowser.Models.EditableOrder>("FlatGrid")
.Datasource(ds => ds.URL("/Grid/DataSource").Adaptor(AdaptorType.UrlAdaptor))
.AllowScrolling()
.ScrollSettings(scroll => { scroll.AllowVirtualScrolling().Height(300).Width(400).FrozenRows(0).VirtualScrollMode(VirtualScrollMode.Continuous); })
.Columns(col =>
{
...
}
)
<script type="text/javascript">
$("#next").ejButton({
click: function (args) {
obj = $("#FlatGrid").ejGrid("instance");
var value = parseInt($("#textbox").val());
obj.gotoPage(value); //using gotoPage method we can navigate to any page in grid
index = (obj.model.pageSettings.pageSize * obj.model.pageSettings.currentPage + 1);
scrollobject = obj.getScrollObject();
if (value == 1)
scrollobject.scrollY(0)
else
scrollobject.scrollY(index,true)
}
});
</script>
|