Search code examples
angularprimengprimeng-turbotable

Trigger sort with icon for primeng turbo table


For PrimeNG Turbo Table, can you make sort only trigger when the sort icons are clicked?

Right now, it triggers whenever I click anywhere int he header cell. I'd like to just trigger when clicking the icons.

I was thinking this may be possible with StopPropogation() somewhere at the icon level...but that may stop the whole sort

https://www.primefaces.org/primeng/#/table/sort


Solution

  • You can move pSortableColumn directive into <p-sortIcon ...>

    <th>Year
    <p-sortIcon [pSortableColumn]="'year'" [field]="'year'"></p-sortIcon>
    </th>
    

    Demo here