File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 31
31
headerCell : i18nService . getSafeText ( 'headerCell' ) ,
32
32
sort : i18nService . getSafeText ( 'sort' )
33
33
} ;
34
+ $scope . isSortPriorityVisible = function ( ) {
35
+ //show sort priority if column is sorted and there is at least one other sorted column
36
+ return $scope . col . sort . priority && $scope . grid . columns . some ( function ( element , index ) {
37
+ return element . sort . priority && element !== $scope . col ;
38
+ } ) ;
39
+ } ;
34
40
$scope . getSortDirectionAriaLabel = function ( ) {
35
41
var col = $scope . col ;
36
42
//Trying to recreate this sort of thing but it was getting messy having it in the template.
37
43
//Sort direction {{col.sort.direction == asc ? 'ascending' : ( col.sort.direction == desc ? 'descending':'none')}}. {{col.sort.priority ? {{columnPriorityText}} {{col.sort.priority}} : '' }
38
44
var sortDirectionText = col . sort . direction === uiGridConstants . ASC ? $scope . i18n . sort . ascending : ( col . sort . direction === uiGridConstants . DESC ? $scope . i18n . sort . descending : $scope . i18n . sort . none ) ;
39
45
var label = sortDirectionText ;
40
- //Append the priority if it exists
41
- if ( col . sort . priority ) {
46
+
47
+ if ( $scope . isSortPriorityVisible ( ) ) {
42
48
label = label + '. ' + $scope . i18n . headerCell . priority + ' ' + col . sort . priority ;
43
49
}
44
50
return label ;
Original file line number Diff line number Diff line change 21
21
aria-label ="{{getSortDirectionAriaLabel()}} ">
22
22
< i
23
23
ng-class ="{ 'ui-grid-icon-up-dir': col.sort.direction == asc, 'ui-grid-icon-down-dir': col.sort.direction == desc, 'ui-grid-icon-blank': !col.sort.direction } "
24
- title ="{{col.sort.priority ? i18n.headerCell.priority + ' ' + col.sort.priority : null}} "
24
+ title ="{{isSortPriorityVisible() ? i18n.headerCell.priority + ' ' + col.sort.priority : null}} "
25
25
aria-hidden ="true ">
26
26
</ i >
27
27
< sub
28
+ ui-grid-visible ="isSortPriorityVisible() "
28
29
class ="ui-grid-sort-priority-number ">
29
30
{{col.sort.priority}}
30
31
</ sub >
You can’t perform that action at this time.
0 commit comments