Angular 8 and ngx-datatable 16.0.2:
I've started using ngx-datatable and am faced with some challenges getting sort to work when I use a headerTemplate. My column definition is like this:
this.columns = [
{
prop: 'name',
name: 'Navn',
headerTemplate: this.headerTpl,
flexGrow: 3
},
...
];
My headerTemplate is declared like this:
@ViewChild('headerTpl', null) headerTpl: TemplateRef<any>;
and in my HTML:
<ng-template #headerTpl let-column="column">
<div class="column-headlines">{{ column.name }}</div>
</ng-template>
The issue is that the css from the class column-headlines
is applied but the column is not sortable. When I remove headerTemplate: this.headerTpl
from my column definition sort works just fine (but styling is of course wrong). What am I missing here?
Here's a StackBlitz where I would have expected my column header to have been styled AND sortable.
It all seems to be tied to the use of the template. As soon as that's in play, everything else goes haywire...