Hi,
I am using UI for ASP.NET MVC Grid.
with the gird option .Scrollable(scrollable => scrollable.Virtual(true)).
There are grid event like
.Events(events => events.Change("onNoDiscountGridChange"))
.Events(events => events
.DataBound("onNoDiscountGridDataBound")
.Save("onNoDiscountGridSave")
.Edit("onNoDiscountGridEdit").
We have requirement scenario that we can dynamically add as many rows user want.
After user successful add row in grid and start entering in it based on this input we need to get data from back end and fill the gird row with the return value.
So when user complete entering input in text box and click tab key ,the scroll bar is visible. After the onNoDiscountGridChange metod is called scroll bar not remain on same position in scroll up and edit row goes hide.
to deal with situation calling scroll() ,have applied below code in onNoDiscountGridChange() but not working at all.
Please suggest what is the solution to keep grid scrollbar at same position during cell edit on change.
function scroll() {
var grid = $('#gridNodiscount').data('kendoGrid');
if (grid.content.data('kendoMobileScroller')) {
grid.content.data('kendoMobileScroller').animatedScrollTo(0, -1 * grid.select().position().top);
} else {
grid.content.animate({
scrollTop: grid.select().position().top
}, 400);
}
}
We are also calling scroll method in the onNoDiscountGridSave and onNoDiscountGridDataBound(arg) method
function onNoDiscountGridSave(e) {
isCostChanged = true;
this.refresh();
scroll();
}
Please let me know if any more clarification needed.
Thanks