@ministryofjustice/frontend 1.6.1 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/moj/all.js
CHANGED
|
@@ -1070,6 +1070,7 @@ MOJFrontend.SortableTable = function(params) {
|
|
|
1070
1070
|
this.body = this.table.find('tbody');
|
|
1071
1071
|
this.createHeadingButtons();
|
|
1072
1072
|
this.createStatusBox();
|
|
1073
|
+
this.initialiseSortedColumn();
|
|
1073
1074
|
this.table.on('click', 'th button', $.proxy(this, 'onSortButtonClick'));
|
|
1074
1075
|
};
|
|
1075
1076
|
|
|
@@ -1103,6 +1104,20 @@ MOJFrontend.SortableTable.prototype.createStatusBox = function() {
|
|
|
1103
1104
|
this.table.parent().append(this.status);
|
|
1104
1105
|
};
|
|
1105
1106
|
|
|
1107
|
+
MOJFrontend.SortableTable.prototype.initialiseSortedColumn = function () {
|
|
1108
|
+
var rows = this.getTableRowsArray();
|
|
1109
|
+
|
|
1110
|
+
this.table.find("th")
|
|
1111
|
+
.filter('[aria-sort="ascending"], [aria-sort="descending"]')
|
|
1112
|
+
.first()
|
|
1113
|
+
.each((index, el) => {
|
|
1114
|
+
var sortDirection = $(el).attr('aria-sort');
|
|
1115
|
+
var columnNumber = $(el).find('button').attr('data-index');
|
|
1116
|
+
var sortedRows = this.sort(rows, columnNumber, sortDirection);
|
|
1117
|
+
this.addRows(sortedRows);
|
|
1118
|
+
})
|
|
1119
|
+
};
|
|
1120
|
+
|
|
1106
1121
|
MOJFrontend.SortableTable.prototype.onSortButtonClick = function(e) {
|
|
1107
1122
|
var columnNumber = e.currentTarget.getAttribute('data-index');
|
|
1108
1123
|
var sortDirection = $(e.currentTarget).parent().attr('aria-sort');
|
|
@@ -11,6 +11,7 @@ MOJFrontend.SortableTable = function(params) {
|
|
|
11
11
|
this.body = this.table.find('tbody');
|
|
12
12
|
this.createHeadingButtons();
|
|
13
13
|
this.createStatusBox();
|
|
14
|
+
this.initialiseSortedColumn();
|
|
14
15
|
this.table.on('click', 'th button', $.proxy(this, 'onSortButtonClick'));
|
|
15
16
|
};
|
|
16
17
|
|
|
@@ -44,6 +45,20 @@ MOJFrontend.SortableTable.prototype.createStatusBox = function() {
|
|
|
44
45
|
this.table.parent().append(this.status);
|
|
45
46
|
};
|
|
46
47
|
|
|
48
|
+
MOJFrontend.SortableTable.prototype.initialiseSortedColumn = function () {
|
|
49
|
+
var rows = this.getTableRowsArray();
|
|
50
|
+
|
|
51
|
+
this.table.find("th")
|
|
52
|
+
.filter('[aria-sort="ascending"], [aria-sort="descending"]')
|
|
53
|
+
.first()
|
|
54
|
+
.each((index, el) => {
|
|
55
|
+
var sortDirection = $(el).attr('aria-sort');
|
|
56
|
+
var columnNumber = $(el).find('button').attr('data-index');
|
|
57
|
+
var sortedRows = this.sort(rows, columnNumber, sortDirection);
|
|
58
|
+
this.addRows(sortedRows);
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
|
|
47
62
|
MOJFrontend.SortableTable.prototype.onSortButtonClick = function(e) {
|
|
48
63
|
var columnNumber = e.currentTarget.getAttribute('data-index');
|
|
49
64
|
var sortDirection = $(e.currentTarget).parent().attr('aria-sort');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ministryofjustice/frontend",
|
|
3
3
|
"description": "The MOJ Frontend contains the code you need to start building user interfaces for UK Ministry of Justice government services.",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.3",
|
|
5
5
|
"main": "moj/all.js",
|
|
6
6
|
"sass": "moj/all.scss",
|
|
7
7
|
"engines": {
|