setDataSource

Sets the dataSource of an existing ListView and rebinds it.

Parameters

dataSource kendo.data.DataSource

The DataSource to which the widget should be bound.

Example - set the data source

<button class="k-button" id="dsBtn">Change DataSource</button>
<div id="listView"></div>

<script>
  $("#listView").kendoListView({
    template: "<div>#: ProductName#</div>",
    dataSource: [
      { ProductName: "Chai" }
    ]
  });
  var dataSource = new kendo.data.DataSource({
    transport: {
      read: {
        url: "https://demos.telerik.com/kendo-ui/service/Products",
        dataType: "jsonp"
      }
    },
    pageSize: 21
  });
  $("#dsBtn").click(function(){
    var listView = $("#listView").data("kendoListView");
    listView.setDataSource(dataSource);
  });
</script>
In this article