Articles in this section
Category / Section

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

1 min read

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 }

],

});

});

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied