diff --git a/packages/bbui/src/Table/Table.svelte b/packages/bbui/src/Table/Table.svelte index b41b77353a..2a22236474 100644 --- a/packages/bbui/src/Table/Table.svelte +++ b/packages/bbui/src/Table/Table.svelte @@ -132,7 +132,7 @@ style += " auto" } fields?.forEach(field => { - const fieldSchema = schema[field.name] + const fieldSchema = schema[field] if (fieldSchema.width) { style += ` ${fieldSchema.width}` } else { @@ -204,6 +204,7 @@ return nameA < nameB ? a : b }) .concat(autoColumns) + .map(column => column.name) } const editColumn = (e, field) => { @@ -299,19 +300,19 @@ {#each fields as field}
sortBy(schema[field.name])} + on:click={() => sortBy(schema[field])} > -
{getDisplayName(schema[field.name])}
- {#if schema[field.name]?.autocolumn} +
{getDisplayName(schema[field])}
+ {#if schema[field]?.autocolumn} {/if} - {#if sortColumn === field.name} + {#if sortColumn === field} {/if} - {#if allowEditColumns && schema[field.name]?.editable !== false} + {#if allowEditColumns && schema[field]?.editable !== false} editColumn(e, field.name)} + on:click={e => editColumn(e, field)} > @@ -342,7 +343,7 @@
{/if} {#if sortedRows?.length} - {#each sortedRows as row} + {#each sortedRows as row, idx}
{#if showEditColumn}
{ - if (!field.preventSelectRow) { + if (!field.startsWith("custom-")) { dispatch("click", row) + } + }} + on:click={() => { + if (!field.startsWith("custom-")) { toggleSelectRow(row) } }} @@ -379,8 +383,8 @@