From 33032379c1022d3d481c71f2ed88f09ea8b4faad Mon Sep 17 00:00:00 2001 From: Tim Igoe Date: Tue, 27 Mar 2018 10:23:39 +0100 Subject: [PATCH 1/2] Tweak to setup of the TOTAL_COUNT value Adjust the regular expression and change the order of processing such that we get a better output of the actual total figure when complex filters are in use. --- js/angular-tablesort.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/angular-tablesort.js b/js/angular-tablesort.js index e260aea..a9b87fa 100644 --- a/js/angular-tablesort.js +++ b/js/angular-tablesort.js @@ -516,10 +516,9 @@ tableSortModule.directive( 'tsRepeat', ['$compile', '$interpolate', function($co var tsExpr = 'tablesortOrderBy:sortFun | tablesortLimit:filterLimitFun | tablesortLimit:pageLimitFun'; var repeatExpr = element.attr(ngRepeatDirective); - var repeatExprRegex = /^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(\s+track\s+by\s+[\s\S]+?)?\s*$/; + var repeatExprRegex = /^\s*([\s\S]+?)\s+in\s+([\S]+?)\s+([\s\S]+?)(\s+track\s+by\s+[\s\S]+?)?\s*$/; var trackByMatch = repeatExpr.match(/\s+track\s+by\s+(\$index|\S+?\.(\S+))/); - var repeatInMatch = repeatExpr.match(repeatExprRegex); - if (trackByMatch) { + if (trackByMatch) { tsWrapperCtrl.setTrackBy(trackByMatch[2] || trackByMatch[1]); } @@ -534,6 +533,8 @@ tableSortModule.directive( 'tsRepeat', ['$compile', '$interpolate', function($co repeatExpr = repeatExpr.replace(repeatExprRegex, '$1 in $2 | ' + tsExpr + '$3'); } + var repeatInMatch = repeatExpr.match(repeatExprRegex); + if (angular.isUndefined(attrs.tsHideNoData)) { var startSym = $interpolate.startSymbol(); var endSym = $interpolate.endSymbol(); From 3fc1f3f0f75507823cd8af8a4cd262c22d58464e Mon Sep 17 00:00:00 2001 From: Tim Igoe Date: Fri, 20 Apr 2018 14:01:46 +0100 Subject: [PATCH 2/2] When calculating the total pages length, throw away static binding, causing problems in the calculation --- js/angular-tablesort.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/angular-tablesort.js b/js/angular-tablesort.js index a9b87fa..c56d803 100644 --- a/js/angular-tablesort.js +++ b/js/angular-tablesort.js @@ -516,6 +516,7 @@ tableSortModule.directive( 'tsRepeat', ['$compile', '$interpolate', function($co var tsExpr = 'tablesortOrderBy:sortFun | tablesortLimit:filterLimitFun | tablesortLimit:pageLimitFun'; var repeatExpr = element.attr(ngRepeatDirective); + repeatExpr = repeatExpr.replace('::', ''); var repeatExprRegex = /^\s*([\s\S]+?)\s+in\s+([\S]+?)\s+([\s\S]+?)(\s+track\s+by\s+[\s\S]+?)?\s*$/; var trackByMatch = repeatExpr.match(/\s+track\s+by\s+(\$index|\S+?\.(\S+))/); if (trackByMatch) {