Closed Smith-Chris1 closed 11 months ago
Do you mean handler.filter(value, filterBy)
?
If so, when you have nested props, il's relatively simple using callbacks where you retrieve the row object (= "item" in your example).
With ThFilter
component:
<ThFilter filterBy={(row) => row.hwinfo.bios}/>
Using DataHanlder :
<script>
export let handler
let value
handler.filter(value, (row) => row.hwinfo.bios)
</script>
<input type="text" bind:value/>
That was super helpful - thank you! I have it working as intended now.
I'm trying to filter by 'bios' which is nested in the hw-info key. I'm not sure how to do it, I've tried setting the filter key to
item['hwinfo'] and item.hwinfo
with no luck. Is this possible?item = { "id": "test-id", "hwinfo": { "bios": "3.4" } }
I know that I can filter with
hwinfo
and search for 3.4, however I will have more fields in the object and some fields may have 3.4 in them as well.