We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to enable horizontal scrolling (Column Scrolling) in Grid, when the column width exceeds the target?

Platform: JavaScript |
Control: ejmGrid |
Published Date: May 23, 2015 |
Last Revised Date: May 23, 2015
Tags: grid, mobile

To enable horizontal scrolling for column, an inbuilt option is present with the scroll settings.
When you set enableColumnScrolling as true, then horizontal scrolling gets enabled. This occurs when the grid element width exceeds the parent element’s width (By default, grid element renders the relative to its parent element). For example, when the parent element of grid container’s width is 400 and the grid container’s width is 700 then, you can scroll the grid container when column scrolling is enabled. Therefore, you can scroll the grid horizontally by swiping left or right onto the grid header. 

Note: The grid element width exceeds its container width only when the width of all individual column is set by using grid’s columns property.
Refer to the following code example.

Script

$(function () {

// the datasource "window.gridData" is referred from jsondata.min.js

var data = ej.DataManager(window.gridData).executeLocal(ej.Query().take(50));

$("#mobgridscrolling").ejmGrid({

dataSource: data,

allowPagingfalse,

allowScrollingtrue,

scrollSettings: { enableColumnScrollingtrue, enableRowScrollingtrue, height: 220 },

columns: [

{ field: "OrderID", headerText"Order ID", width: 100 },

{ field: "CustomerID", headerText"Customer ID", width: 140 },

{ field: "Freight", headerText"Freight", width: 100 },

{ field: "EmployeeID", headerText"EmployeeID", width: 150 },

{ field: "ShipCity", headerText"ShipCity", width: 150 }

],

});

});

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon