-
Notifications
You must be signed in to change notification settings - Fork 851
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
107 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -640,21 +640,76 @@ 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-table-pagination': 'params', | ||
'template-url': '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); | ||
} | ||
}; | ||
} | ||
} | ||
} | ||
]); | ||
|
||
/** | ||
* ngTable: Table + Angular JS | ||
* | ||
* @author Vitalii Savchuk <[email protected]> | ||
* @url https://github.com/esvit/ng-table/ | ||
* @license New BSD License <http://creativecommons.org/licenses/BSD/> | ||
*/ | ||
|
||
/** | ||
* @ngdoc directive | ||
* @name ngTable.directive:ngTablePagination | ||
* @restrict A | ||
*/ | ||
app.directive('ngTablePagination', ['$compile', | ||
function ($compile) { | ||
'use strict'; | ||
|
||
return { | ||
restrict: 'A', | ||
scope: { | ||
'params': '=ngTablePagination', | ||
'templateUrl': '=' | ||
}, | ||
replace: false, | ||
link: function (scope, element, attrs) { | ||
|
||
scope.$watch('params.$params', function (newParams, oldParams) { | ||
scope.pages = scope.params.generatePagesArray(scope.params.page(), scope.params.total(), scope.params.count()); | ||
}, true); | ||
|
||
scope.$watch('templateUrl', function(templateUrl) { | ||
if (angular.isUndefined(templateUrl)) { | ||
return; | ||
} | ||
var template = angular.element(document.createElement('div')) | ||
template.attr({ | ||
'ng-include': 'templateUrl' | ||
}); | ||
element.append(template); | ||
$compile(template)(scope); | ||
}); | ||
} | ||
}; | ||
} | ||
]); | ||
|
||
angular.module('ngTable').run(['$templateCache', function ($templateCache) { | ||
$templateCache.put('ng-table/filters/select-multiple.html', '<select ng-options="data.id as data.title for data in column.data" multiple ng-multiple="true" ng-model="params.filter()[name]" ng-show="filter==\'select-multiple\'" class="filter filter-select-multiple form-control" name="{{column.filterName}}"> </select>'); | ||
$templateCache.put('ng-table/filters/select.html', '<select ng-options="data.id as data.title for data in column.data" ng-model="params.filter()[name]" ng-show="filter==\'select\'" class="filter filter-select form-control" name="{{column.filterName}}"> </select>'); | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters