【问题标题】:Pagination for dynamic data (API) in ng2 smart tableng2 智能表中动态数据 (API) 的分页
【发布时间】:2019-01-23 04:04:22
【问题描述】:
   columns: {
      Name: {
    title: 'Name',
         filter: false,
  },
  Description: {
    title: 'Description',
         filter: false,


  },
},
add: {
  addButtonContent: '<i class="nb-plus"></i>',
  createButtonContent: '<i class="nb-checkmark"></i>',
  cancelButtonContent: '<i class="nb-close"></i>',
},
edit: {
  editButtonContent: '<i class="nb-edit"></i>',
  saveButtonContent: '<i class="nb-checkmark"></i>',
  cancelButtonContent: '<i class="nb-close"></i>',
},
delete: {
  deleteButtonContent: '<i class="nb-trash"></i>',
  confirmDelete: true,
},

};

来源:服务器数据源;

构造函数(私有 http: Http, globals: Globals){

this.source = new ServerDataSource(http, { endPoint: GlobalVariable.BASE_API_URL+'/api/InspectionService/GetInspectionStatus' });

}

我通过上述方法填充了 ng2 智能表中的数据..但是视图上没有出现分页...我错过了什么?使用 serverdatasource 如何使分页出现??

【问题讨论】:

    标签: angular pagination ng2-smart-table


    【解决方案1】:

    据我所知,寻呼机是自动设置的。如果您在文档中查找“pager.display”和“pager.perPage”,您将设置默认值。

    根据我的经验,如果数据或配置存在问题,寻呼机将无法工作/显示。您确定您的数据和配置正确且没有错误吗?

    如果您想将寻呼机设置为不同的值,您可以在配置中进行:

    this.settings = {
                columns: {
                  ...
                },
                ...
                pager:
                {
                  perPage: 20
                }
              };
    

    或者你可以用DataSource来设置:

    this.source.setPaging(2,20);
    

    【讨论】:

      【解决方案2】:

      我用这种方式,效果很好

      this.YourlocalDataSource.setPaging(1, 10, true);

      页面10行数

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-04-20
        • 1970-01-01
        • 2021-08-04
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多