Remove sorting by auto ID when output processing rows

This commit is contained in:
Andrew Kingston 2021-05-13 15:35:54 +01:00
parent 6de9ccd28b
commit 26014f4e5c
3 changed files with 3 additions and 23 deletions

View File

@ -47,6 +47,7 @@
<style>
.spectrum-Pagination-counter {
margin-left: 0;
user-select: none;
}
.is-disabled:hover {
cursor: initial;

View File

@ -166,9 +166,8 @@ class QueryBuilder {
}
if (this.sort) {
const orderChar = this.sortOrder === "descending" ? "-" : ""
url += `&sort="${orderChar}${this.sort.replace(/ /, "_")}<${
this.sortType
}>"`
url += `&sort="${orderChar}${this.sort.replace(/ /, "_")}`
url += `<${this.sortType}>"`
}
if (this.bookmark) {
url += `&bookmark=${this.bookmark}`

View File

@ -123,24 +123,6 @@ function processAutoColumn(user, table, row) {
return { table, row }
}
/**
* Given a set of rows and the table they came from this function will sort by auto ID or a custom
* method if provided (not implemented yet).
*/
function sortRows(table, rows) {
// sort based on auto ID (if found)
let autoIDColumn = Object.entries(table.schema).find(
schema => schema[1].subtype === AutoFieldSubTypes.AUTO_ID
)
// get the column name, this is the first element in the array (Object.entries)
autoIDColumn = autoIDColumn && autoIDColumn.length ? autoIDColumn[0] : null
if (autoIDColumn) {
// sort in ascending order
rows.sort((a, b) => a[autoIDColumn] - b[autoIDColumn])
}
return rows
}
/**
* Looks through the rows provided and finds formulas - which it then processes.
*/
@ -213,8 +195,6 @@ exports.outputProcessing = async (appId, table, rows) => {
rows = [rows]
wasArray = false
}
// sort by auto ID
rows = sortRows(table, rows)
// attach any linked row information
let enriched = await linkRows.attachFullLinkedDocs(appId, table, rows)