setDataSource

Sets the DataSource of an existing ListView and rebinds it.

Parameters

dataSource kendo.data.DataSource

Example

<div data-role="view">
  <a data-role="button" data-click="rebindListView">Rebind</a>
  <ul id="listView" data-role="listview" data-template="foo-template" data-source="foo" data-style="inset">
  </ul>
</div>

<script id="foo-template">
    #: name #
</script>

<script>
var foo = new kendo.data.DataSource({ data: [ { name: "foo" } ] });
var bar = new kendo.data.DataSource({ data: [ { name: "bar" } ] });

function rebindListView() {
    $("#listView").data("kendoMobileListView").setDataSource(bar);
}

new kendo.mobile.Application();
</script>
In this article