Skip to content

Commit

Permalink
fix bug with pagination without jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
esvit committed Apr 12, 2014
1 parent 65f69eb commit d0397b8
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/scripts/05-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,22 @@ app.directive('ngTable', ['$compile', '$q', '$parse',
pagination: (attrs.templatePagination ? attrs.templatePagination : 'ng-table/pager.html')
};
var headerTemplate = thead.length > 0 ? thead : angular.element(document.createElement('thead')).attr('ng-include', 'templates.header');
var paginationTemplate = angular.element('<tfoot />').append(angular.element('<tr />').append(angular.element('<td />').attr({ 'ng-include': 'templates.pagination', 'colspan': columns.length })));
var paginationRow = angular.element(document.createElement('tr'))
.append(angular.element(document.createElement('td'))
.attr({
'ng-include': 'templates.pagination',
'colspan': columns.length
})),
paginationTemplate = angular.element(document.createElement('tfoot')).append(paginationRow);

element.find('thead').remove();
var tbody = element.find('tbody');
element.prepend(headerTemplate);

element.addClass('ng-table')
.prepend(headerTemplate)
.append(paginationTemplate);

$compile(headerTemplate)(scope);
$compile(paginationTemplate)(scope);
element.addClass('ng-table');
tbody.after(paginationTemplate);
}
};
}
Expand Down

0 comments on commit d0397b8

Please sign in to comment.