简体   繁体   中英

PrimeNG DataTable Filtering filterMatchType not default

I am trying to get a data column to filter based on a "contains" match type, but it doesn't seem to work right for me. Anyone have any ideas?

Here is a Plunker , try filtering by "f70":

<p-dataTable [value]="orderList">
    <p-column field="itemDesc" header="Item"  filter="true" filterMatchMode="contains" filterPlaceholder="Contains" sortable="custom" (sortFunction)="onItemSort($event)">
      <template let-col let-row="rowData" pTemplate="body">
        <a [href]="'/e/fm/fm2/item/home.cfm?item_id=' + row['itemId']" target="_blank">{{row['itemNo']}} - {{row['itemDesc']}}</a>
      </template>
    </p-column>
</p-dataTable>

You are having this problem because you are using old version of PrimeNG where filtering had a lot of bugs, to be more precise, version 1.1.2 , which can be seen on line 54 of systemjs.config.js file in your Plunker :

'primeng': 'npm:primeng@1.1.2/primeng.js'

If you use latest version ( 2.0.3 ), your filter with filterMatchMode="contains" will work like a charm. So, just change version in your system.config.js file:

'primeng': 'npm:primeng@2.0.3/primeng.js'

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