This is a migrated thread and some comments may be shown as answers.

Kendo UI and jquery scrollTop not working correctly on ios and android browsers

5 Answers 217 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Hans asked on 18 Nov 2013, 03:35 PM
After changing kendo grid's DataSource, scroll remains in the same position(see image).  I'm trying to scroll content of the grid to the top:

var gridContent = grid.wrapper.find(".k-grid-content");
 gridContent.scrollTop(0);

But this doesn't work on my iPad in Safari browser. How i can scroll content of kendo grid to the top?

http://s2.ipicture.ru/uploads/20131118/9dEuPIBB.png
Kendo UI Beta v2013.2.716

5 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 20 Nov 2013, 02:49 PM
Hi Hans,

The scrollTop method is not working because on touch screen devices the Grid uses mobile scroller.
You can reset it with the reset method. For example:
var grid = $("#grid").data("kendoGrid");
grid.content.data("kendoMobileScroller").reset();


Note that executing this code on desktop browser will produce an error.
If you want to support both scenarios you can use kendo.support.mobileOS - if it is undefined then the Grid is opened on a desktop browser where scrollTop should be used.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Hans
Top achievements
Rank 1
answered on 22 Nov 2013, 02:41 PM
Strange, this doesn't work for me. kendo.support.mobileOS is 'false' in descktop browser instead of 'undefined' and grid.content.data("kendoMobileScroller").reset() doesn't scroll grid's content to the top.
0
Alexander Valchev
Telerik team
answered on 25 Nov 2013, 08:29 AM
Hi Hans,

You are correct, kendo.support.mobileOS returns false on desktop. The misleading comes from a typo in the docs which I already fixed and the fix should be published live soon.

I am not sure why the problem with the reset method occurs. Could you please provide a small sample which demonstrates your current implementation so I can examine it?
Thank you in advance.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Hans
Top achievements
Rank 1
answered on 25 Nov 2013, 01:54 PM
When i need to scroll my grid to the top, i call this code:

if(typeof(kendo.support.mobileOS) == "object")
   grid.content.data("kendoMobileScroller").reset();

It calls reset method but nothing happens. Also i found another solution that works for me. But it can be broken after some changes inside kendo grid:

grid.wrapper.find(".km-scroll-container").css("-webkit-transform", "");
0
Alexander Valchev
Telerik team
answered on 25 Nov 2013, 03:11 PM
Hello Hans,

The provided code looks OK. Without a runnable sample which we can debug locally we cannot determine what exactly goes wrong. Please provide such sample and we will check it right away.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Hans
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Hans
Top achievements
Rank 1
Share this question
or