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 44f0e71aec
commit 1a729aca91
3 changed files with 3 additions and 23 deletions

View File

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

View File

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

View File

@ -123,24 +123,6 @@ function processAutoColumn(user, table, row) {
return { 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. * Looks through the rows provided and finds formulas - which it then processes.
*/ */
@ -213,8 +195,6 @@ exports.outputProcessing = async (appId, table, rows) => {
rows = [rows] rows = [rows]
wasArray = false wasArray = false
} }
// sort by auto ID
rows = sortRows(table, rows)
// attach any linked row information // attach any linked row information
let enriched = await linkRows.attachFullLinkedDocs(appId, table, rows) let enriched = await linkRows.attachFullLinkedDocs(appId, table, rows)