-
-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support nested properties in DataTable filtering search #1897
Comments
Playing around a bit locally I got some ugly version to work with the following code, which of course is horrible:
So it searches through all data available, not just the visible data. Though if I remove the id column from the table, it no longer searches in that. There is some odd behavior here from a usage perspective. My expectation was that it uses the header defined fields, which is not the case. I will give it a go with a user defined function next in the hopes of not needing my ugly hack. But a generic solution would be pretty welcome I think. |
The horribleness continues, however this does the job for my usecase for the very moment in time. It's crappy if you have have nested replies, so perhaps having limited or flattened replies would be better for other use cases, or the ability to specify which fields to look for and supporting nested properties would be great. Just pasting the Toolbar here for brevity, the rest is bog standard.
|
I was able to reproduce the issue; would be a good fix for DataTable. Reproduction: https://svelte.dev/repl/4012e79a919f42d6b3fe5179ef774757?version=4.2.9 (cannot search for 'super'). |
Here I have a simple example of what I mean:
This example works by showing the correct field in the table. However, when using the search filter it will not find anything in the contact.company field, but it will find a match in the id field.
My guess is the culprit is somewhere here:
carbon-components-svelte/src/DataTable/ToolbarSearch.svelte
Lines 57 to 67 in f1cafd4
The table itself I seen in a past issue had a similar problem.
https://github.com/carbon-design-system/carbon-components-svelte/pull/602/files
My guess would be the fix now lives around here in the more modern version of the code:
carbon-components-svelte/src/DataTable/DataTable.svelte
Lines 199 to 206 in f1cafd4
I'm not familiar enough with all pieces involved to make a proper PR, but it seems like a reasonably straight forward thing to fix from the little I do understand about the code. It would be greatly appriciated.
The text was updated successfully, but these errors were encountered: