discovery
discovery copied to clipboard
Tree view doesn't work with properties containing object
Data
[{ id: 1, a: { id: 3, val: 1 }}, { id: 2, b: [{ id: 4, val: 1 }]}]
View
{
view: 'tree',
children: 'a or b',
item: [
'text:id', 'struct'
],
expanded: 100
}
Actual Result

Expected To see object with id 3 in tree
Workaround that I have found. At least for now
{
view: 'tree',
data: '',
children: '$r: (a or b) + []; $r.[size() > 1]',
item: [
'text:id', 'struct'
],
expanded: 100
}
One more workaround (a or b or []) + []
A solution from 2024: a or b | is array ?:? [$] (or the full form: a or b | is array ? $ : ($ ? [$] : undefined))
More solutions:
-
a or b | is object ? [$] : $ora or b | is not object ?: [$] -
[...a or b].[](creates temporary array) -
a or b |? [...]or full forma or b | $ ? [...$] : $(creates temporary array)
Thanks, I think that will be enough for now.