ng-table: Sorting problem after grunt build
Sorting wont work after ‘grunt build’, I assume it is the js-minify that somehow breaks it. Nothing happens when I click a header. Strange though that everything else works. Anyone with similar problems?
Here’s my directive controller
controller: ['$scope', '$filter', 'ScoresAPI', 'ngTableParams', function($scope, $filter, ScoresAPI, ngTableParams)
{
ScoresAPI.getLeagueStandings($scope.leagueId)
.success(function(data)
{
$scope.tableParams = new ngTableParams({
page: 1,
count: data.length,
sorting: false
}, {
total: data.length,
counts: [],
getData: function($defer, params)
{
var orderedData = params.sorting() ? $filter('orderBy')(data, params.orderBy()) : data;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
});
}]
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 29
Commits related to this issue
- Fix lack of sorting on tables due to minification See https://github.com/esvit/ng-table/issues/230 — committed to gabegorelick/fracas by apoku 10 years ago
- try fix for ng-table sorting (https://github.com/esvit/ng-table/issues/230) — committed to hsr-ba-fs15-dat/opendatahub by fabio-scala 9 years ago
In my case it wasn’t the jsminify target. But was the htmlmin target. I changed
collapseBooleanAttributes
to false and it solved the issue for me. Here is the whole configuration of the target:Both solutions worked for me. However I was having a CSS issue as well (see the 2 up arrows on not sorted columns):
Setting the following option fixed the issue:
@andreicristianpetcu’s approach worked for us too (team is switching to that so we can still reap benefits of gulp-htmlmin’s optimizations elsewhere).
I solved my issue. I replaced 'sortable=“‘name’”" with 'data-sortable=“‘name’”" and it works. Check this out: http://bit.ly/1BgfqTu