Fixing a bug where if you created a column without a name editting it would create another column and also adding an option to remove sorting from your table.
This commit is contained in:
parent
535c9febd5
commit
dbd6237e44
|
@ -94,7 +94,8 @@ export const getBackendUiStore = () => {
|
||||||
saveField: ({ originalName, field }) => {
|
saveField: ({ originalName, field }) => {
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
// delete the original if renaming
|
// delete the original if renaming
|
||||||
if (originalName) {
|
// need to handle if the column had no name, empty string
|
||||||
|
if (originalName || originalName === "") {
|
||||||
delete state.draftTable.schema[originalName]
|
delete state.draftTable.schema[originalName]
|
||||||
state.draftTable._rename = {
|
state.draftTable._rename = {
|
||||||
old: originalName,
|
old: originalName,
|
||||||
|
|
|
@ -43,7 +43,11 @@
|
||||||
|
|
||||||
function sort(direction, column) {
|
function sort(direction, column) {
|
||||||
backendUiStore.update(state => {
|
backendUiStore.update(state => {
|
||||||
state.sort = { direction, column }
|
if (direction !== "none") {
|
||||||
|
state.sort = {direction, column}
|
||||||
|
} else {
|
||||||
|
state.sort = undefined
|
||||||
|
}
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
hideEditor()
|
hideEditor()
|
||||||
|
@ -70,6 +74,12 @@
|
||||||
<Icon name="delete" />
|
<Icon name="delete" />
|
||||||
Delete
|
Delete
|
||||||
</li>
|
</li>
|
||||||
|
{#if sortDirection === 'desc' || sortDirection === 'asc'}
|
||||||
|
<li on:click={() => sort('none', field.name)}>
|
||||||
|
<Icon name="close" />
|
||||||
|
Remove sort
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
{#if sortDirection === 'desc' || sortColumn !== field.name}
|
{#if sortDirection === 'desc' || sortColumn !== field.name}
|
||||||
<li on:click={() => sort('asc', field.name)}>
|
<li on:click={() => sort('asc', field.name)}>
|
||||||
<Icon name="sortascending" />
|
<Icon name="sortascending" />
|
||||||
|
|
Loading…
Reference in New Issue