Broadcast a sort event from BBUI table, and add prop to disable table sorting of data
This commit is contained in:
parent
b5ff5a7f76
commit
05cfd87613
|
@ -27,6 +27,7 @@
|
||||||
export let selectedRows = []
|
export let selectedRows = []
|
||||||
export let editColumnTitle = "Edit"
|
export let editColumnTitle = "Edit"
|
||||||
export let customRenderers = []
|
export let customRenderers = []
|
||||||
|
export let disableSorting = false
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortRows = (rows, sortColumn, sortOrder) => {
|
const sortRows = (rows, sortColumn, sortOrder) => {
|
||||||
if (!sortColumn || !sortOrder) {
|
if (!sortColumn || !sortOrder || disableSorting) {
|
||||||
return rows
|
return rows
|
||||||
}
|
}
|
||||||
return rows.slice().sort((a, b) => {
|
return rows.slice().sort((a, b) => {
|
||||||
|
@ -131,6 +132,7 @@
|
||||||
sortColumn = fieldSchema.name
|
sortColumn = fieldSchema.name
|
||||||
sortOrder = "Descending"
|
sortOrder = "Descending"
|
||||||
}
|
}
|
||||||
|
dispatch("sort", { column: sortColumn, order: sortOrder })
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDisplayName = schema => {
|
const getDisplayName = schema => {
|
||||||
|
|
Loading…
Reference in New Issue