Inconsistencies with Kendo UI and jquery scrollTop functionality on mobile browsers such as iOS and Android are

While using the kendo ui - grid control, I encountered an issue where resetting the data source did not automatically bring the grids scroll position back to the top.

To address this, I tried adding a jquery scrollTop(0) call after refreshing the datasource. It worked on desktop browsers but not on iPads.

$("#switch-data-btn").on("click", function(){ 
    grid.dataSource.data(currentData);
    grid.dataSource.transport.data = currentData;
    grid.content.scrollTop(0);
    grid.refresh();
});

http://jsfiddle.net/BFAnK/6/

I then opted to destroy and rebuild the grid instead of simply refreshing the data. This eliminated the need for the scrollTop(0) call and resolved the issue.

$("#switch-data-btn").on("click", function() {
  buildGrid(currentData); 
  // buildGrid() destroys the grid, empties the dom element and recreates it.
});

http://jsfiddle.net/BFAnK/11/

Although the above solution is effective for a specific scenario, it has its limitations. For instance, attempting to scroll to a specific position with scrollTop() on an iPad may result in being unable to scroll back up to view earlier results (unlike on desktop browsers).

$("#switch-data-btn").on("click", function() {
  buildGrid(currentData);
  grid.content.scrollTop(50);
});

http://jsfiddle.net/BFAnK/12/

Are there any suggestions on efficiently reloading data into an existing kendo grid and scrolling to a desired position that works consistently across various browsers?

Answer №1

Kendo grid is enclosed within a scroll wrapper. To scroll it to the top, you can utilize the following code snippet:

grid.wrapper.find(".km-scroll-container").css("-webkit-transform", "");

Update:

Response directly from Kendo support team:

The scrollTop function may not work as expected on touch screen devices due to the Grid's utilization of mobile scroller. You can reset it using the reset method. Here's an example:

var grid = $("#grid").data("kendoGrid");
grid.content.data("kendoMobileScroller").reset();

Please be aware that running this code on a desktop browser will result in an error. For compatibility with both scenarios, consider checking kendo.support.mobileOS - if undefined, it indicates the Grid is accessed through a desktop browser and scrollTop should be used.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The issue of Three.js SkinnedMesh jittering arises when it is distant from the scene's root (0,0,0)

In my current project, I am developing a third-person RPG style game using Three.js and Blender. The terrain in the game world is tiled and loops endlessly in all directions, triggered when the player object approaches defined edges along the z or x-axis. ...

Unable to retrieve information from the JSON object

Here's the script I'm working with: <script type="text/javascript> function getData(username){ $.ajax({ url: '{% url "data" %}', data: { ' ...

Scrolling and adjusting window size while perfectly displaying images pixel by pixel using php and javascript

I'm currently working on a forum concept that will feature images. I'm looking to have the image displayed at default width and height, but also want users to be able to resize the window to view more of the image as needed. Additionally, I would ...

Authenticate yourself as a user or an organization on mongodb

I am currently developing an application that requires user registration and login, as well as organization registration and login. I have implemented the use of Node.js Passport with a local strategy for authentication. While I have successfully created t ...

What is the best way to create vertical spacing between Material UI Grid Paper components?

The spacing of the goal components is not as I would like it to be. This is how they currently appear. https://i.stack.imgur.com/jApzK.png So far, I have attempted setting the display of the Paper selector to flex. Additionally, I experimented with adjus ...

The design of RESTful web applications with a client-server architecture

I need clarification on how client-server architecture should function for a modern web application with a RESTful backend. For a web app, the client is typically the browser while the server is the web server. Programatically speaking, there are componen ...

Concealing a feature across all pages of the website

I have implemented alert boxes that appear on all pages of the website. https://i.sstatic.net/hWShr.gif Users can individually close each alert box: $(document).ready(function() { $("#close-alert-box-news").click(function() { $("#alert-box-news" ...

Expanding form fields dynamically with AngularJS

I am currently working on a form that allows users to click a '+' sign in order to add new lines. I've set up a function to be called when the button is clicked, which should push a new line into the array. However, for some reason the new l ...

What steps can you take to resolve the "TypeError: Cannot read property 'id' of undefined" issue?

I have been developing an app that involves using databases to add items for users based on their user ID, which is their username. However, whenever I attempt to add an item, I encounter an error that I can't seem to troubleshoot. The error message r ...

Javascript coding for monitoring health status using a three.js health bar

After updating to version r127, my health bar stopped working. I'm not sure what changes I need to make to get it working again. There seems to be an error with the shader in this version. Here is the code: Code: import * as THREE from './thre ...

I'm looking to integrate Jest in my React project with npm. How can I achieve

I've developed my application with create react app and npm. While reviewing the official documentation for jest at https://jestjs.io/docs/tutorial-react, I noticed that they only provide information on testing CRA apps using yarn. Does this suggest t ...

Is it possible to use an input value to rotate an element?

I'm attempting to rotate a red circle with the ID of outer using Input[type=range]. I've tried selecting the circle's style, then transforming it based on the input value, but it needs to be within the parentheses of rotateZ(), which require ...

Creating first-person shooter game controls using Three.js in JavaScript

I am currently in the process of creating a small 3D FPS Game using Three.js, but I am in need of assistance with the controls. To better illustrate what I am aiming for, please watch this video to see the desired controls in action (only the controls, no ...

The damping effect in three.js OrbitControls only activates when the mouse is pressed, however there is no damping effect once the

I find it difficult to articulate: Currently, I am utilizing OrbitControls in three.js and have activated damping for a smoother rotation with the mouse. It is somewhat effective but not entirely seamless. When I click and drag, the damping feature works ...

No data returned from Ajax GET request

Utilizing Ajax with JavaScript, I am processing data on a PHP page using the GET method. Is it possible to send data from the PHP page when the GET query is empty? My goal is to have a live search feature that filters results based on user input. When a us ...

Receiving Array Data from JSON and Listing Results

Once I retrieve the first row result from a JSON array, I want to display all the results using the jQuery each method. Here is the code snippet: $(document).ready(function () { $("#btnsearch").click(function() { valobj = $('#search_box' ...

What is the correct way to invoke a function from an external JavaScript file using TypeScript?

We are currently experimenting with incorporating Typescript and Webpack into our existing AngularJS project. While I have managed to generate the webpack bundle, we are facing an issue at runtime where the program is unable to locate certain functions in ...

Should you consider using the Singleton pattern in Node.js applications?

After stumbling upon this specific piece discussing the creation of a singleton in Node.js, it got me thinking. The require functionality according to the official documentation states that: Modules are cached after the first time they are loaded. Multi ...

Retrieving attribute values when using the .on function in jQuery

I currently have 10 links with the following format: <a href="#" data-test="test" class="testclass"></a> as well as a function that looks like this: $(document).on("click", ".testclass", function () { alert($(this).attr('data-t ...

Effortlessly fill dropdown menus with data from JSON files

I've been using this jQuery code successfully, but I recently needed to add 3 more field columns to the JSON. My goal is to have the HTML select drop-downs dynamically change based on the data from the previous drop-down. Additionally, my current jQue ...