samu/angular-table

Is the sorting of links within a <td> element supported?

Closed this issue · 3 comments

I have a table like this:

 <table at-table at-paginated at-list="filteredList" at-config="config">
    <thead>
    </thead>
    <tbody>
      <tr>
        <td at-title="user"><a ng-href="#" at-attribute="user" at-implicit></a></td>
        <td at-implicit at-attribute="score" at-sortable></td>
        <td at-implicit at-attribute="lastActivity" at-sortable></td>
      </tr>
    </tbody>
  </table>

and all works fine, but I am struggling to make the user column sortable.

This does not work:

<td at-title="user"><a ng-href="#" at-attribute="user" at-implicit at-sortable></a></td>

And this only allows sorting the column once:

<td at-title="user" at-sortable><a ng-href="#" at-attribute="user" at-implicit></a></td>

Is this just not supported or am I doing something wrong? Any help appreciated, thanks.

samu commented

@deciob please note that you can use at-attribute and at-implicit only in the <td>-element. Try changing this line

<td at-title="user" at-sortable><a ng-href="#" at-attribute="user" at-implicit></a></td>

to this

<td at-title="user" at-attribute="user" at-sortable><a ng-href="#">{{item.user}}</a></td>

Please note the use of {{item.user}}. item gives you access to each row.

@samu thank you very much for this. It worked correctly.

@samu Thank you very much. :)
This is exactly what I'm wondering.
Very helpful.