How to control scrollbar option per dataSource size in a kendoGrid control

1 Answer 9 Views
Grid
George
Top achievements
Rank 3
Bronze
Bronze
Iron
George asked on 10 Sep 2025, 06:06 PM | edited on 10 Sep 2025, 06:16 PM

Hi,

Would like to dynamically control whether a grid has a slider control for the roles.

The algorithm /flow would look something like this:

grid is declared and options initialized  within windows.onload or $(document).ready(function() {});

user makes selection to load grid  

data populates the datSource from an API request.

  if(dataSource.length > 10 )
    then let scrollable = true;
  else
scrollable = false;


The idea here is it would dynamically adjust that scrollable option after a certain length threshold would be met.

attached here is how I have my grid set up..also I have the sort and dataBound handlers doing stuff.

Here is inline version of JavaScript / jQuery kendo code that declares and does some initialization:

 $("#myGrid").kendoGrid({
     width: 1400,
     height: 500,
     sortable: {
         mode: "single",
         allowUnsort: false
     },
     resizable: true,
     editable: true,
     scrollable: true,
     columns: modifiedColumns, // Use updated columns
     dataSource: mappingsDS,
     selectable: "multiple, row",

Thanks,

George

1 Answer, 1 is accepted

Sort by
0
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
answered on 11 Sep 2025, 03:36 PM

You can set the scrollable property via options, e.g.

  var grid = $("#myGrid").data("kendoGrid");
  grid.options.scrollable = (data.length > 10);

However, it appears that it needs to be set before the dataSource is set -- if you set it after, either inline or via the dataBound event, it is too late.

This dojo provides an example. In the toggle() function, if you comment out setting scrollable before the dataSource and uncomment setting it after, it doesn't work. Similarly, uncommenting setting it in the dataBound event doesn't work either.

 

Tags
Grid
Asked by
George
Top achievements
Rank 3
Bronze
Bronze
Iron
Answers by
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
Share this question
or