adds functional single select to builder
This commit is contained in:
parent
b4cc7c6776
commit
dabcecc7db
|
@ -8,8 +8,6 @@
|
||||||
export let schema
|
export let schema
|
||||||
export let linkedRows = []
|
export let linkedRows = []
|
||||||
|
|
||||||
console.log(schema)
|
|
||||||
console.log(linkedRows)
|
|
||||||
let rows = []
|
let rows = []
|
||||||
|
|
||||||
$: label = capitalise(schema.name)
|
$: label = capitalise(schema.name)
|
||||||
|
@ -34,11 +32,8 @@
|
||||||
return row[linkedTable.primaryDisplay || "_id"]
|
return row[linkedTable.primaryDisplay || "_id"]
|
||||||
}
|
}
|
||||||
|
|
||||||
let oneToManyRow = getPrettyName(linkedRows[0]) || ''
|
$: console.log(rows)
|
||||||
|
$: console.log(linkedRows)
|
||||||
function oneToManyValueSetter(value) {
|
|
||||||
linkedRows = [value]
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if linkedTable.primaryDisplay == null}
|
{#if linkedTable.primaryDisplay == null}
|
||||||
|
@ -50,10 +45,10 @@
|
||||||
</Label>
|
</Label>
|
||||||
{:else}
|
{:else}
|
||||||
{#if schema.oneToMany}
|
{#if schema.oneToMany}
|
||||||
<Select on:change={e => oneToManyValueSetter(e.target.value)} value={getPrettyName(oneToManyRow)} name="Test" label="Flavour">
|
<Select on:change={e => linkedRows = [e.target.value]} name={label} {label}>
|
||||||
<option value="">Choose an option</option>
|
<option value="">Choose an option</option>
|
||||||
{#each rows as row}
|
{#each rows as row}
|
||||||
<option value={row._id}>{getPrettyName(row)}</option>
|
<option selected={row._id === linkedRows[0]} value={row._id}>{getPrettyName(row)}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
Loading…
Reference in New Issue