Reputation: 405
I am having issue with fooTable in AngularJS ,here is what i am doing:
<table class="table m-b-none" ui-jq="footable" data-filter="#filter" data-page-size="5">
<thead>
<tr>
<th data-toggle="true">Name</th>
<th data-hide="phone">Logo</th>
<th data-hide="phone,tablet">Website</th>
<th data-hide="phone,tablet" data-name="Friendly URL">URL</th>
<th data-hide="all">External Parameter 1</th>
<th data-hide="all">External Parameter 2</th>
<th data-hide="all">Meta Keywords</th>
<th data-hide="all">Meta Description</th>
<th data-hide="all">Period</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="store in stores">
<td>{{store.name}}</td>
<td><img ng-src="{{store.logo}}" /></td>
<td>{{store.website}}</td>
<td>{{store.friendly_url}}</td>
<td>{{store.external_parameter1}}</td>
<td>{{store.external_parameter2}}</td>
<td>{{store.meta_keywords}}</td>
<td>{{store.meta_description}}</td>
<td>{{store.period}}</td>
<td data-value="1">
<!--Edit Button-->
<a type="button" class="btn btn-xs btn-default" ui-sref="app.store.edit({editId: store.id})">
<i class="fa fa-pencil"></i>
</a>
<!--Delete Button-->
<a type="button" class="btn btn-xs btn-default" ng-click="deleteStore(store.id)">
<i class="fa fa-trash"></i>
</a>
</td>
</tr>
</tbody>
<tfoot class="hide-if-no-paging">
<tr>
<td colspan="10" class="text-center">
<ul class="pagination"></ul>
</td>
</tr>
</tfoot>
</table>
When i refresh the page by pressing F5
the output is as it should be:
then after i click somewhere else e.g. Add Store
and come back to this page, now the picture changes:
the + icon gone, and all <td>
are showing, they are not getting hide, as it should be.
Here is my controller:
app.controller('storesCtrl', ['$scope', '$http', function($scope, $http) {
$scope.stores = {};
$http.get("http://MyApiUrl/store.php").
success(function(data){
$scope.stores = data;
//$('.table').trigger('footable_redraw');
});
}]);
I also tried using $('.table').trigger('footable_redraw');
but no luck.
Please help, thanks
Upvotes: 1
Views: 3744
Reputation: 405
I found the solution:
success(function(data){
$scope.stores = data;
$timeout(function(){
$('.table').trigger('footable_redraw');
}, 100);
});
Upvotes: 6