change

Fires when the ScrollView page is changed.

Event Data

e.currentPage Number

The current page (zero-based index).

e.nextPage Number

The next page (zero-based index).

e.element jQuery

The page element. In the standard mode, the parameter will be undefined.

Available only in the data-bound mode.

e.data Array

The data collection. In the standard mode, the parameter will be undefined.

Available only in the data-bound mode.

e.preventDefault Function

If invoked, prevents the change action.

Example - hooking up to the change event

<div id="scrollview"></div>

<script id="scrollview-template" type="text/x-kendo-template">
  <div style="width: 110px; height: 110px; background-image: #=setBackground(ProductID)#;"></div>
  <p>#= ProductName #</p>
</script>

<script>
$("#scrollview").kendoScrollView({
      dataSource: dataSource,
      template: "scrollview-template",
      contentHeight: "120px",
      enablePager: false,
      change: change
});

var dataSource = new kendo.data.DataSource({
  type: "odata",
  transport: {
    read: {
      url: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Products"
    }
  },
  serverPaging: true,
  pageSize: 30
});

function setBackground(id) {
  return "url(https://demos.telerik.com/kendo-ui/content/web/foods/" + id +".jpg)";
}

function change(e) {
  console.log("page ", e.page, "data: ", e.data);
  //handle event
}
</script>
In this article
Not finding the help you need? Improve this article