10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-03 20:53:59 +01:00

Better csv (#11)

* Fix broken link

* Fix bug in indexDB

* Fix sourceFile  for each geometry

* Fix line break in methods for the csv

* Repeat the cell instead of putting a blank cell when the row/column span of the cell is larger than one

Co-authored-by: Mickaël Véril <mveril@irsamc.ups-tlse.fr>
This commit is contained in:
mveril 2020-12-08 13:42:47 +01:00 committed by GitHub
parent 24cc2153e0
commit 7838048223
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -403,7 +403,8 @@ draft: false
Reflect.setPrototypeOf(key, method.prototype) Reflect.setPrototypeOf(key, method.prototype)
th = $("<th/>", { scope: "column" }) th = $("<th/>", { scope: "column" })
const meth = key const meth = key
th.clone().text(meth.toString("\n").split('-').join('\u2011')).appendTo(row) const span = $("<span/>",{"data-csvtext":meth.toString()}).text(meth.toString("\n").split('-').join('\u2011'))
th.clone().append(span).appendTo(row)
const noNanVals = (vals.every((v) => Number.isNaN(v))) ? vals : (vals.filter((v) => !Number.isNaN(v))) const noNanVals = (vals.every((v) => Number.isNaN(v))) ? vals : (vals.filter((v) => !Number.isNaN(v)))
const avals = noNanVals.map(v => Math.abs(v)) const avals = noNanVals.map(v => Math.abs(v))
th.clone().text(noNanVals.length).appendTo(row) th.clone().text(noNanVals.length).appendTo(row)
@ -588,7 +589,10 @@ draft: false
var tbody = $("<tbody/>").appendTo(table) var tbody = $("<tbody/>").appendTo(table)
var th = $("<th/>", { scope: "column" }) var th = $("<th/>", { scope: "column" })
head.append(["Molecule", "Transition"].map(x => th.clone().text(x))) head.append(["Molecule", "Transition"].map(x => th.clone().text(x)))
head.append(sortedMethods.map(x => th.clone().text(x.toString("\n").split('-').join('\u2011')))) head.append(sortedMethods.map(x => {
const span = $("<span/>",{"data-csvtext":x.toString()}).text(x.toString("\n").split('-').join('\u2011'))
return th.clone().append(span)
}))
adjustSticky(); adjustSticky();
datadic = new Map() datadic = new Map()
for (const dat of paperdata) { for (const dat of paperdata) {

View File

@ -40,13 +40,13 @@ function tableToCSV(table) {
const rowIndex = cell.parentNode.rowIndex const rowIndex = cell.parentNode.rowIndex
if (columnspan>1) { if (columnspan>1) {
for (let i = 1; i < rowspan; i++) { for (let i = 1; i < rowspan; i++) {
csv[rowIndex].splice(colindex,0,"") csv[rowIndex].splice(colindex,0,csv[rowIndex][colindex])
} }
} }
if (rowspan>1) { if (rowspan>1) {
for (let i = 0; i < columnspan; i++) { for (let i = 0; i < columnspan; i++) {
for (let j = 1; j < rowspan; j++) { for (let j = 1; j < rowspan; j++) {
csv[rowIndex+j].splice(colindex,0,"") csv[rowIndex+j].splice(colindex,0,csv[rowIndex][colindex])
} }
} }
} }