简体   繁体   中英

primeng v11.2.0: p-columnFilter not showing

Dear all I am using the p-table component from primeNG library:

在此处输入图像描述

the main filter (highlighted input box) is working but when I click on the funnel next to the 'Sample' nothing happens and no error is showing in the console. I am expecting something similar to the following:

在此处输入图像描述

Here is my code:

<p-table #dt1 id="graphData" [value]="graphData" dataKey="sample" [rows]="6" [showCurrentPageReport]="true" [rowsPerPageOptions]="[6,10,25,50]" [loading]="loading" styleClass="p-datatable-gridlines" [paginator]="true" currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
                            [globalFilterFields]="['sample','tyre_pressure','speed','power']">
                            <ng-template pTemplate="caption">
                                <div class="flex">
                                    <button pButton label="Clear" class="p-button-outlined" icon="pi pi-filter-slash" (click)="clear(dt1)"></button>
                                    <span class="p-input-icon-left ml-auto">
                                        <i class="pi pi-search"></i>
                                        <input #filterName pInputText type="text"
                                            (input)="dt1.filterGlobal($event.target.value, 'contains')"
                                            placeholder="Search keyword" />
                                    </span>
                                </div>
                            </ng-template>
                            <ng-template pTemplate="header">
                                <tr>
                                    <th>
                                        <div class="flex justify-content-center align-items-center">
                                            Sample
                                            <p-columnFilter type="text" field="graphData.sample" display="menu">
                                            </p-columnFilter>
                                        </div>
                                    </th>
                                    <th>
                                        <div class="flex justify-content-center align-items-center">
                                            Tyre Pressure
                                            <p-columnFilter type="number" field="tyre_pressure" display="menu">
                                            </p-columnFilter>
                                        </div>
                                    </th>

The text filter in p-columFilter is not showing when I press the funnel button:

<th>
                                        <div class="flex justify-content-center align-items-center">
                                            Sample
                                            <p-columnFilter type="text" field="graphData.sample" display="menu">
                                            </p-columnFilter>
                                        </div>
                                    </th>

What am i missing?

I have discovered that primeng V13 is not compatible with the latest version of angular cli. After downgrading to:

"primeflex": "^3.0.0",
"primeicons": "^4.1.0",
"primeng": "^12.2.2",

the filter buttons worked

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM