Improve grid relationship handling of null or empty values

This commit is contained in:
Andrew Kingston 2020-10-15 12:16:32 +01:00
parent 98d066ac33
commit 9d8cbaedbb
1 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,10 @@
export let columnName
export let row
$: count =
row && columnName && Array.isArray(row[columnName])
? row[columnName].length
: 0
let linkedRows = []
let displayColumn
@ -33,9 +37,11 @@
<div class="container">
{#if linkedRows && linkedRows.length && displayColumn}
{#each linkedRows as linkedRow}
<div class="linked-row">{linkedRow[displayColumn]}</div>
{#if linkedRow[displayColumn] != null && linkedRow[displayColumn] !== ''}
<div class="linked-row">{linkedRow[displayColumn]}</div>
{/if}
{/each}
{/if}
{:else}{count} related row(s){/if}
</div>
<style>