【问题标题】:kendo datasource pagination剑道数据源分页
【发布时间】:2013-03-30 05:01:03
【问题描述】:

我在我的 MVC 项目中使用数据表进行排序和分页。所以分页和排序是有效的。

现在的问题是-

我已经为数据表显示了pagesize:5。它每页显示 5 行,但不显示 pagenumbers。如何使用 kendo 数据源显示分页以显示下一个页码的下 5 个数据行。

看看我的代码-

 var template = kendo.template($("#template").html());

    // To Do Item Data
    // ---------------



    // Build the data source for the items
    var dataSource = new kendo.data.DataSource(
    { transport: {
        read: "/Task/Read"
    }, schema: {
        data: "Data"
    },
    serverGrouping: true,
    sort: { field: "TaskID", dir: "asc" },
    serverPaging: true,
    pageSize: 5 
});

    // When the data source changes, render the items
    dataSource.bind("change", function (e) {
        //alert('Bind');
        var html = kendo.render(template, this.view());
        $("#todos tbody").html(html);
    });

    // Initial read of the items in to the data source

    dataSource.read();




</script>

HTML 代码-

  <tr>
      <td> 
          <input type="checkbox" class="done" data-id="#= TaskID #" ></input>
      </td>
      <td>
          #= TaskID #
      </td>
      <td>
        #= Subject #
      </td>
      <td>
      #=AssignedTo#
      </td>
  </tr>
</script>
<div class="row-fluid">
<div class="span4"> <table id="todos" class="table table-striped table-bordered">
      <thead>
        <tr>
          <th>Done</th>
          <th>ID</th>
          <th>Task</th>
          <th>Assign To</th>
        </tr>
      </thead>
      <tbody>

      </tbody>

    </table></div>
</div>

请告诉我如何显示页码以显示其余行。我已经从 kendo UI Grid 迁移到 kendo 数据源并使用引导程序对其进行样式设置。

【问题讨论】:

    标签: twitter-bootstrap asp.net-mvc-4 datatable kendo-ui


    【解决方案1】:

    试试这个:将“** pageable: true **”添加到数据源之外的剑道网格配置中,例如:

    $("#grid").kendoGrid({
      scrollable: true,
      sortable: true,
     ** pageable: true,**
    

    【讨论】:

    • 显示页码,但不显示剩余列表,如果我能用 jquery 本身来做就好了。
    【解决方案2】:

    您可以使用 Kendo UI Pager。有用的链接:

    ListView 分页演示(使用 Kendo UI Pager 实现):http://demos.kendoui.com/web/listview/index.html

    寻呼机 API 参考:http://docs.kendoui.com/api/web/pager

    【讨论】:

      猜你喜欢
      • 2015-04-26
      • 1970-01-01
      • 1970-01-01
      • 2016-08-18
      • 1970-01-01
      • 2013-08-29
      • 2023-03-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多