pullParameters Function

A callback function used when the 'pullToRefresh' option is enabled. The result of the function will be send as additional parameters to the DataSource's next method.

Notice: When the listview is in a virtual mode, the pull to refresh action removes the previously loaded items in the listview (instead of appending new records at the top). Previously loaded pages in the DataSource are also discarded.

Example

<div data-role="view" data-init="initListView">
  <ul id="listview">
  </ul>
</div>

<script>
var i = 0;

// datasource below is customized for demo purposes.
var foo = new kendo.data.DataSource({
  transport: {
    read: function(options) {
/* The result can be observed in the DevTools(F12) console of the browser. */
      console.log(options.data.since_id); // undefined in the first request
      var max = i + 5;
      var data = [];
      for (; i < max; i ++) {
        data.unshift({ name: "record" + i, modified: +new Date() });
      }
      options.success(data);
    }
  }
});

function initListView(e) {
  $("#listview").kendoMobileListView({
    dataSource: foo,
    pullToRefresh: true,
    template: "#: name # - #: modified #",
    pullParameters: function(item) {
/* The result can be observed in the DevTools(F12) console of the browser. */
      console.log(item); // the last item currently displayed
      return { since_id: item.name };
    }
  });

}

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

Parameters

item Object

First dataItem of the ListView // => listView.dataSource.get(0);

In this article
Not finding the help you need? Improve this article