/**
-* @version 2.1.8
+* @version 2.1.5
* @license MIT
*/
(function (ng, undefined){
ng.module('smart-table', []).run(['$templateCache', function ($templateCache) {
$templateCache.put('template/smart-table/pagination.html',
'<nav ng-if="numPages && pages.length >= 2"><ul class="pagination">' +
- '<li ng-repeat="page in pages" ng-class="{active: page==currentPage}"><a href="javascript: void(0);" ng-click="selectPage(page)">{{page}}</a></li>' +
+ '<li ng-repeat="page in pages" ng-class="{active: page==currentPage}"><a ng-click="selectPage(page)">{{page}}</a></li>' +
'</ul></nav>');
}]);
sort: {
ascentClass: 'st-sort-ascent',
descentClass: 'st-sort-descent',
- descendingFirst: false,
skipNatural: false,
delay:300
},
var stateClasses = [classAscent, classDescent];
var sortDefault;
var skipNatural = attr.stSkipNatural !== undefined ? attr.stSkipNatural : stConfig.sort.skipNatural;
- var descendingFirst = attr.stDescendingFirst !== undefined ? attr.stDescendingFirst : stConfig.sort.descendingFirst;
var promise = null;
var throttle = attr.stDelay || stConfig.sort.delay;
//view --> table state
function sort () {
- if (descendingFirst) {
- index = index === 0 ? 2 : index - 1;
- } else {
- index++;
- }
-
+ index++;
var func;
predicate = ng.isFunction(getter(scope)) || ng.isArray(getter(scope)) ? getter(scope) : attr.stSort;
if (index % 3 === 0 && !!skipNatural !== true) {
$timeout.cancel(promise);
}
if (throttle < 0) {
- func();
+ scope.$apply(func);
} else {
promise = $timeout(func, throttle);
}
element.bind('click', function sortClick () {
if (predicate) {
- scope.$apply(sort);
+ sort();
}
});