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 }) => {
|
||||
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,
|
||||
|
|
|
@ -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" />
|
||||
|
|
Loading…
Reference in New Issue