问题
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