0

Can I use pSortableColumn with an internal function call to compute my column values dynamically without using a form variable? I want something like. This doesn't throw any error but my column doesn't sort on my PrimeNG's p-table.

 <th scope="col" [pSortableColumn]="'getValues(wi.codes)'">Values<p-sortIcon [field]="'getValues(wi.codes)'"></p-sortIcon></th>

Here's my function

getValues(codes) {
    let values= [];
    codes.forEach((element, idx) => {
      if (idx <= 2)
        values.push(element.someCode)
    });
    return values;
  }
SJoe
  • 319
  • 2
  • 6
  • 14

0 Answers0