Edit this page

setDataItem

Re-renders the given listview item with the new dataItem provided. In order for the method to work as expected, the data items should be of type kendo.data.Model.

Parameters

item jQuery

The listview item to update

dataItem kendo.data.Model

The new dataItem

Example

<div data-role="view" data-init="initialItem">
    <a data-role="button" data-click="changeItem">Add item</a>
    <ul id="listview" data-role="listview" data-template="foo">
    </ul>
</div>

<script type="text/x-kendo-template" id="foo">
Item #: idx #
</script>

<script>
var dataItem = new kendo.data.Model({ idx: 1 });

function initialItem() {
  $("#listview").data("kendoMobileListView").append([dataItem]);
}

function changeItem() {
  var newItem = new kendo.data.Model({idx: 2});
  $("#listview").data("kendoMobileListView").setDataItem($("#listview li").eq(0), newItem);
}

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