0

我在我的 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 数据源并使用引导程序对其进行样式设置。

4

2 回答 2

2

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

$("#grid").kendoGrid({
  scrollable: true,
  sortable: true,
 ** pageable: true,**
于 2013-03-30T05:12:11.933 回答
1

您可以使用 Kendo UI 寻呼机。有用的链接:

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

寻呼机 API 参考:http ://docs.kendoui.c​​om/api/web/pager

于 2013-03-30T07:18:05.860 回答