add selectFirstRowByDefault for tables

This commit is contained in:
Ruben Fiszel
2023-12-08 23:57:52 +01:00
parent 4800ebb864
commit c398cc64b1
2 changed files with 11 additions and 2 deletions
@@ -127,7 +127,8 @@
mounted = true
})
$: selectedRowIndex === -1 &&
$: resolvedConfig?.selectFirstRowByDefault != false &&
selectedRowIndex === -1 &&
Array.isArray(result) &&
result.length > 0 &&
// We need to wait until the component is mounted so the world is created
@@ -208,7 +209,9 @@
if (result) {
//console.log('rerendering table', result[0])
toggleRow({ original: filteredResult[0] }, true)
if (resolvedConfig?.selectFirstRowByDefault != false) {
toggleRow({ original: filteredResult[0] }, true)
}
}
if (outputs.page.peak()) {
@@ -1534,6 +1534,12 @@ This is a paragraph.
value: {},
tooltip:
'any configuration that can be passed to the tanstack table component as initial state (https://tanstack.com/table/v8/docs/api/core/table#initialstate)'
},
selectFirstRowByDefault: {
type: 'static',
fieldType: 'boolean',
value: true as boolean,
tooltip: 'Select the first row by default on start'
}
},
componentInput: {