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

Most upvoted comments

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:

htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          collapseBooleanAttributes: false,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html', 'app_components/{,**/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    }

Both solutions worked for me. However I was having a CSS issue as well (see the 2 up arrows on not sorted columns): ng-table-css-min

Setting the following option fixed the issue:

        cssmin: {
            options: {
                advanced: false
            }
        },


@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