I am having the data points like an array. So I am trying to search the value inside the array but it is not working in primeng
In the component file I am having the below part of code,
tableHeader = [
{ field: 'name', header: 'Name' },
{ field: 'skills', header: 'Skills' },
];
modelData = [
{ "label": "HTML", "value": "HTML" },
{ "label": "Css", "value": "Css" },
{ "label": "Angular", "value": "Angular" },
{ "label": "Python", "value": "Python" },
{ "label": "Perl", "value": "Perl" },
{ "label": "JS", "value": "JS" },
{ "label": "Java", "value": "Java" }
];
data = [
{
name:"User1",
skills:["JS","Java","Angular"]
},{
name:"TestUser",
skills:["HTML","Css"]
},{
name:"Root",
skills:["HTML","Css","Angular","Python","Perl"]
}
];
And the html is
<p-table #dt [value]="data">
<ng-template pTemplate="header">
<tr>
<th>Name</th>
<th>Skills</th>
</tr>
<tr>
<th>
<input pInputText type="text" (input)="dt.filter($event.target.value, 'name', 'contains')">
</th>
<th>
<p-multiSelect [options]="modelData" (onChange)="dt.filter($event.value, 'skills', 'in')"></p-multiSelect>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData>
<tr>
<td>{{rowData['name']}}</td>
<td>
<span *ngFor="let skill of rowData.skills;">
{{skill}}
</span>
</td>
</tr>
</ng-template>
<p-table>
I am able to search the Name
field but I am not able to search the Skills
field. because it contains the array value.