'Angular + PrimeNG: clear datatable INDIVIDUAL column sorting and filtering ( table.reset() works but it resets all table sorting/filtering )

The below code works but its resetting the all datatable filters and sorting, what im trying to acomplish is to only reset this specific column (name) sorting and filtering, so if another column is sorted (via multiple sort option) I want it not to be reseted.

Would highly appreciate a fix for this.

Thank you.

HTML:

    <th pSortableColumn="name">
        <div class="p-d-flex p-jc-between p-ai-center">
        Name
        <p-sortIcon field="name"></p-sortIcon>
        <p-columnFilter #name type="text" field="name" display="menu" class="p-ml-auto"></p-columnFilter>
        <button pTooltip="Clear Column Filters" (click)="clearColumn($event, name)" type="button" class="p- column-filter-clear-button p-link ng-tns-c78-13 ng-star-inserted">
            <span class="pi pi-filter-slash ng-tns-c78-13"></span>
        </button>
        </div>
    </th>

TS:

clearColumn(event: any, name: any){

    event.stopPropagation();

    name.dt.reset();

}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source