Kendo Listview数据源问题

时间:2014-09-20 06:25:21

标签: kendo-ui kendo-datasource kendo-listview

我正在使用分页处理kendo ui listvie。在每次我移动到下一页时,它将调用datasource。在我的场景中,如果我选择第4页,它将调用数据源4次。

下面是代码

function InitiateContactList() {
  var RouteDataSource = null;
  RouteDataSource = new kendo.data.DataSource({
    serverPaging: true,
    type: "aspnetmvc-ajax",
    create: {
      contentType: "application/json"
    },
    transport: {
      read: {
        url: '@Url.Content("~/Partner/GetPartnerContacts")',
        data: { lPartnerId: $("#hdnPartnerId").val() },
        dataType: "json",
        type: "get",
      }
  },
  serverFiltering: true,
  pageSize: 2,
  schema: {
    data: "Data",
    total: "Total"
  }
  });

  $("#copyRoutelistdata").kendoListView({
    autoBind: false,
    dataSource: RouteDataSource,
    template: kendo.template($("#Contactstemplate").html()),
    //selectable: "single",
    //pageable: true,
    change: function (e) {
      var index = this.select().index();
      dataItem = this.dataSource.view()[index];
      if (dataItem != null && dataItem.RouteId != null) {
      //CopyRoute(dataItem.RouteId);
      //HideWindow('MdCopyRouteSearch');
      }
    },
    dataBound: function (e) {
      $("#RoutelistPager").kendoPager({
      autoBind:false,
      dataSource: RouteDataSource
      });
    }
  });
  RouteDataSource.read();
}

提前致谢。

0 个答案:

没有答案