Edit this page

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>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy