mariuszfoltak/angular2-datatable

Filter by another column, other than "name"

Opened this issue · 1 comments

Sedaj commented

I want to be able to filter by other column than the name. My data must contain name property because it's trying to filter it by that column by default:

....
<th colspan="5">
    Filter by the value of Parameter: &nbsp;
    <!-- I don't know what's filterQuery, there's no documentation -->
    <input class="form-control" [(ngModel)]="filterQuery"/>
</th>
</tr>
</thead>
<tbody>
    <!-- in my data, i have 2 fields, id and value, i want to be able to filter by value, not name -->
    <template let-parameterValue ngFor [ngForOf]="mf.data" let-i="index" >
        <tr>
            <td>{{ parameterValue.id }}</td>
            <td>{{ parameterValue.value }}</td>
        </tr>
    </template>
</tbody>
....

how can I achieve that? thank you

you write your own pipe