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:
mike12345567 2020-10-14 18:04:21 +01:00
parent 535c9febd5
commit dbd6237e44
2 changed files with 13 additions and 2 deletions

View File

@ -94,7 +94,8 @@ export const getBackendUiStore = () => {
saveField: ({ originalName, field }) => {
store.update(state => {
// 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]
state.draftTable._rename = {
old: originalName,

View File

@ -43,7 +43,11 @@
function sort(direction, column) {
backendUiStore.update(state => {
state.sort = { direction, column }
if (direction !== "none") {
state.sort = {direction, column}
} else {
state.sort = undefined
}
return state
})
hideEditor()
@ -70,6 +74,12 @@
<Icon name="delete" />
Delete
</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}
<li on:click={() => sort('asc', field.name)}>
<Icon name="sortascending" />