p-table rowsPerPageOptions does not expand the dropdown

三世轮回 提交于 2019-12-23 06:05:11

问题


I'm using the p-table component trying to show the paginator with the dropdown with rows per page option (rowsPerPageOptions):

<p-table
  [columns]="cols"
  [value]="myData"
  [paginator]="true"
  [rows]="2"
  [rowsPerPageOptions]="[1,2,3]">

The table shows up fine with the paginator control, but the dropdown that contains the per-page option does not expand (drop).

Here's the stackblitz link of the app - https://stackblitz.com/edit/angular-xywt2w?file=app/provider-search/provider-search.component.html

Why does the dropdown not work?


回答1:


Make sure you import BrowserAnimationsModule in your app.module.ts

import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 

@NgModule({
  imports: [ BrowserModule,BrowserAnimationsModule ... ]
  // ...
})



回答2:


Correct form:

[rowsPerPageOptions]="['5', '10', '20', '50']"


来源:https://stackoverflow.com/questions/48939143/p-table-rowsperpageoptions-does-not-expand-the-dropdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!