You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a table that displays items with an unique id of each.
I'd like to implement a global filter that supports search on various fields, e.g. value included in description. It should be also possible to filter a specific item by id.
Now, I'd like the filter to display only the single item matching a given id, if and only if the input matches exactly one id. In this case, it should not match e.g. descriptions including the same value. If there is no such unique match for id, i'd like to filter as usually.
Now, in normal javascript, I'd probably use something like Array.filter's third argument, the full array, but this is not exposed. Ideally, I'd like to hook in right before the global filter anyway, so I compute it only once. But I'd could do the same in the filter function using a memoized function, as long as i could access all rows.
Is there something I'm missing? How'd you handle such a filter scenario?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have a table that displays items with an unique id of each.
I'd like to implement a global filter that supports search on various fields, e.g. value included in description. It should be also possible to filter a specific item by id.
Now, I'd like the filter to display only the single item matching a given id, if and only if the input matches exactly one id. In this case, it should not match e.g. descriptions including the same value. If there is no such unique match for id, i'd like to filter as usually.
Now, in normal javascript, I'd probably use something like Array.filter's third argument, the full array, but this is not exposed. Ideally, I'd like to hook in right before the global filter anyway, so I compute it only once. But I'd could do the same in the filter function using a memoized function, as long as i could access all rows.
Is there something I'm missing? How'd you handle such a filter scenario?
Beta Was this translation helpful? Give feedback.
All reactions