fix(apps): improve tanstack table handling of objects

This commit is contained in:
Ruben Fiszel
2024-08-13 16:17:20 +02:00
parent 527183874c
commit 1d0807f542
2 changed files with 9 additions and 2 deletions
@@ -80,7 +80,11 @@
{:else}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div on:dblclick={toggleEdit}>
{value}
{#if typeof value == 'object'}
{JSON.stringify(value)}
{:else}
{value}
{/if}
</div>
{/if}
</td>
@@ -28,8 +28,11 @@
for (let i = 0; i < objArray.length; i++) {
let line = ''
for (let j = 0; j < headers.length; j++) {
const value = objArray[i][headers[j]]
let value = objArray[i][headers[j]]
line += j ? ',' : ''
if (typeof value != 'string') {
value = JSON.stringify(value)
}
line += /[\",\n]/.test(value) ? '"' + value.replace(/"/g, '""') + '"' : value
}
str += line + '\r\n'