@ministryofjustice/frontend
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -1073,2 +1073,3 @@ ;(function(root, factory) { | ||
this.createStatusBox(); | ||
this.initialiseSortedColumn(); | ||
this.table.on('click', 'th button', $.proxy(this, 'onSortButtonClick')); | ||
@@ -1107,2 +1108,16 @@ }; | ||
MOJFrontend.SortableTable.prototype.initialiseSortedColumn = function () { | ||
var rows = this.getTableRowsArray(); | ||
this.table.find("th") | ||
.filter('[aria-sort="ascending"], [aria-sort="descending"]') | ||
.first() | ||
.each((index, el) => { | ||
var sortDirection = $(el).attr('aria-sort'); | ||
var columnNumber = $(el).find('button').attr('data-index'); | ||
var sortedRows = this.sort(rows, columnNumber, sortDirection); | ||
this.addRows(sortedRows); | ||
}) | ||
}; | ||
MOJFrontend.SortableTable.prototype.onSortButtonClick = function(e) { | ||
@@ -1109,0 +1124,0 @@ var columnNumber = e.currentTarget.getAttribute('data-index'); |
@@ -14,2 +14,3 @@ MOJFrontend.SortableTable = function(params) { | ||
this.createStatusBox(); | ||
this.initialiseSortedColumn(); | ||
this.table.on('click', 'th button', $.proxy(this, 'onSortButtonClick')); | ||
@@ -48,2 +49,16 @@ }; | ||
MOJFrontend.SortableTable.prototype.initialiseSortedColumn = function () { | ||
var rows = this.getTableRowsArray(); | ||
this.table.find("th") | ||
.filter('[aria-sort="ascending"], [aria-sort="descending"]') | ||
.first() | ||
.each((index, el) => { | ||
var sortDirection = $(el).attr('aria-sort'); | ||
var columnNumber = $(el).find('button').attr('data-index'); | ||
var sortedRows = this.sort(rows, columnNumber, sortDirection); | ||
this.addRows(sortedRows); | ||
}) | ||
}; | ||
MOJFrontend.SortableTable.prototype.onSortButtonClick = function(e) { | ||
@@ -50,0 +65,0 @@ var columnNumber = e.currentTarget.getAttribute('data-index'); |
{ | ||
"name": "@ministryofjustice/frontend", | ||
"description": "The MOJ Frontend contains the code you need to start building user interfaces for UK Ministry of Justice government services.", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"main": "moj/all.js", | ||
@@ -6,0 +6,0 @@ "sass": "moj/all.scss", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
639765
10133