Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 带分页的ng zorro表格_Angular_Antd_Ng Zorro Antd - Fatal编程技术网

Angular 带分页的ng zorro表格

Angular 带分页的ng zorro表格,angular,antd,ng-zorro-antd,Angular,Antd,Ng Zorro Antd,我在使用分页的ng zorr表时遇到问题。使用如下所示的单独组件进行分页 <nz-table #dynamicTable [nzScroll]="fixHeader ? { y: '240px' } : null" [nzData]="countryList" [nzLoading]="loading" [nzShowPagination]="false"

我在使用分页的ng zorr表时遇到问题。使用如下所示的单独组件进行分页

<nz-table #dynamicTable
                [nzScroll]="fixHeader ? { y: '240px' } : null"
                [nzData]="countryList"
                [nzLoading]="loading"
                [nzShowPagination]="false"
                [nzFooter]="footer ? 'Sayfalama' : null"
                [nzTitle]="title ? 'Müşteri Listesi' : null"
                [nzSize]="size">
        <thead>
        <tr *ngIf="header">
<!--          <th nzWidth="50px"></th>-->
          <th nzWidth="150px">Kod</th>
          <th nzWidth="70px">Ad</th>
          <th>3'lü kod</th>
          <th nzWidth="260px">Telefon kodu</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let data of dynamicTable.data">
<!--          <td nzShowCheckbox *ngIf="checkbox" [(nzChecked)]="data.checked"></td>-->
          <td>{{ data.code }}</td>
          <td>{{ data.name }}</td>
          <td>{{ data.tripleCode }}</td>
          <td>{{ data.phoneCode }}</td>
        </tr>
        </tbody>
      </nz-table>
      <br>
      <nz-pagination class="pagination" nzShowSizeChanger nzShowQuickJumper [nzTotal]="total" [(nzPageIndex)]="pageIndex" [(nzPageSize)]="pageSize"
                     (nzPageSizeChange)="pageSizeChanged($event)" (nzPageIndexChange)="pageIndexChanged($event)"
                     [nzPageSizeOptions]="pageSizeOptions">
      </nz-pagination>

API返回17条记录,但表中仅显示10条记录。如果我使用带有页码的页面导航,我可以看到所有带有页面大小的记录。但是,如果我直接更改页面大小(例如,将其设置为每页20条),则表中只显示10条记录,而不显示更多内容。但API返回的结果与预期一致。

您需要为count pages和[pageIndex]、[pageSize]添加[nzTotal]。

尝试将[nzPageIndex]和[nzPageSize]添加到Ohhh!!如果使用服务器端分页
loadPage() {
    this.apiService.postAny(['ListAsync'], null, this.filterModel).subscribe(data => {
      if (this.apiService.checkResponse(data)) {
        this.loading = false;
        this.total = data.result.count;
        this.countryList = [];
        this.countryList = data.result.result as CountryListModel[];
      }
    }, error => {
      console.log(error);
    }, () => {
      console.log('Country load completed !');
    });
  }