Closed seonyukim closed 8 months ago
Hey @seonyukim , can you show us an example of how you would like to manually filter the data? You can currently do this by passing in a setAllFilters hook
That was enabled in this PR
@AlexanderMelox Can you check this Slack thread? We posted what we wanted and how we use setAllFilters and that is not working
The slack thread isn't working for me, I'm not in the IBM Security workspace. May you take screen shots?
oops I forgot to add thread link https://ibm-security.slack.com/archives/C013ZTX0N6B/p1689602026794799
But basically, setAllFilters
could be used externally, but when trying to set that function it never got called. setAllFilters that could be used externally, but when trying to set that function it never got called. Can you explain what the intended behaviour of this is?
We us React table v7 under the hood. And this is the setAllFilters hooks they provide. https://github.com/TanStack/table/blob/v7/docs/src/pages/docs/api/useFilters.md#instance-properties
Then in our component you would just use it like this
const datagridState = useDatagrid({
...
}, useFilters)
const {setAllFilters} = datagridState;
<button onClick={() => setAllFilters([ { id: 'name', value: 'John' } ])}>click</button>
Basically, we don't load all the data into a table at once. We have millions of data in some cases. We load the first set of data(first page) with pagination. If we do the filter only on the loaded data, this is useless in our case.
I don't think setAllFilters
is not for this case. I might misunderstand.
@matthewgallo would you have any input on this?
Hi all,
Perhaps I could offer some insight, for manual filtering (and sorting) you'll need to pass in the manualFilters: true
option to the useDatagrid
hook. Then to get the options selected, they're available in the datagridState
instance.
The summary tags are still set but the table will not filter your data until you make an api request.
Hope that helps!
const datagridState = useDatagrid({
columns,
data,
...,
manualFilters: true,
manualSortBy: true,
}, useFilters)
const {
state: {
sortBy,
filters
}
} = datagridState;
@seonyukim Check @xmannyxfreshx1 comment, someone else had this issue and they were able to get it to work 🚀
@AlexanderMelox: For clarity... the supported solution will be the snippet provided by @xmannyxfreshx1? Will this be documented formally? (FYI @seonyukim, we'll discuss on your return.)
What package(s) are you using?
Detailed description
DataGrid filtering does this all internally on the data provided. We grab data per page, so this filter would only filter the current page of data. Is there a way to:
yes, DataGrid component
Be able to use filter data in the api layer (detail is above)
V2.4.0
CP4S QRadar suit. We were waiting for the filter panel long time. Without this functionality, the filter panel is useless to us. We need this functionality as soon as possible.
Steps to reproduce the issue
Additional information
Here is the slack message: https://ibm-security.slack.com/archives/C013ZTX0N6B/p1689602026794799