Below static example has sort on first name, but disabled sort on email column:
<tr>
<th st-sort="firstName">first name</th>
<th>email</th>
</tr>
But, my columns are dynamic. So I am creating dynamic column headers in an ng-repeat
. Wether columns should be sortable or not is decided by an isSortable
flag.
<tr>
<th st-sort="column.isSortable" ng-repeat="column in columns">{{column.columnName}}</th>
</tr>
How do I make only the colums with isSortable
set as true
sortable?
I suggest you set your st-sort on an inner element
and if you don't want to repeat yourself, you can embed this logic within a directive