angular-footable icon indicating copy to clipboard operation
angular-footable copied to clipboard

Sort doesn't work if ng-repeat is used for populating the header <th>

Open shirishc opened this issue 8 years ago • 6 comments

The sorting by clicking the header and toggle-arrow-tiny works nicely normally but doesn't work well when I use ng-repeat like this shown below. I still get the headers with correct text but no sorting or the toggle icons on the headers.

<th ng-repeat="curr_header in headers">{{curr_header}}</th>

Can you please help ?

shirishc avatar Feb 28 '17 13:02 shirishc

+1. It just doesn't work. Personally I tried with ng-attr in order to specify parameters for footable, and it doesn't work neither.

jquinter avatar Mar 28 '17 02:03 jquinter

I have a similar issue. I use ng-repeat for th and it screws up the footable-redraw, when i hard code the headers it works...

Sumedha-Scry avatar May 31 '17 05:05 Sumedha-Scry

My issue is solved - used load-when

Sumedha-Scry avatar May 31 '17 17:05 Sumedha-Scry

@Sumedha-Scry: Can you explain how to use load-when in

with a value bound to angular scope? Does it work along with data-hide attribute?

Moxy1683 avatar May 31 '17 19:05 Moxy1683

@Moxy1683 e.g to use load-when: assume two scope variables : data : has some rows in json format. for eg: [{'id':1,'name':'test'}] headers : contains keys from data. continuing above eg. ['id','name']

<div  ng-if="data.length">
<table class="footable" load-when="data">
    <thead>
         <tr>
             <th ng-repeat="header in headers">{{header}}</th>
         </tr>
    </thead>
    <tbody>
         <tr  ng-repeat="row in data">
             <td ng-repeat="h in headers">{{row[h]}}</td>
         </tr>
    </tbody>
</table>
</div>

To answer your second question, I have not tried it but theoretically it should work. Hope this helps.

Sumedha-Scry avatar Jun 05 '17 22:06 Sumedha-Scry

It's not working bro same issue occured if any one get solution plz post it

abmeman avatar Sep 01 '17 05:09 abmeman