add ability to set css class to sortable tables. Make certificates table certificates class

pull/34/head
Zlatin Balevsky 2019-12-17 12:52:33 +00:00
parent f0ffc68122
commit 5788329e1a
2 changed files with 11 additions and 1 deletions

View File

@ -98,6 +98,7 @@ class CertificateResponse {
else if (params.order == "ascending")
newOrder = "descending"
var table = new Table(["Issuer", "Name", "Timestamp", "Import"], "sort", params.key, newOrder, this.divId)
table.setCSSClass("certificates")
var i
for (i = 0; i < this.certificates.length; i++) {

View File

@ -39,14 +39,23 @@ class Table {
this.rows = []
this.key = key
this.descending = descending
this.cssClass = null
}
addRow(mapping) {
this.rows.push(mapping)
}
setCSSClass(cssClass) {
this.cssClass = cssClass
}
render() {
var html = "<table><thead><tr>"
var html = "<table>"
if (this.cssClass != null) {
html = "<table class='" + this.cssClass + "'>"
}
html += "<thead><tr>"
var i
for (i = 0;i < this.columns.length; i++) {
if (this.columns[i].key == this.key)