Open crichtonibm opened 5 months ago
+1 for this - I've noticed the same
From office hours — could try out autoResetGlobalFilter: false
.
Note, will become a bigger usability issue once the team supports SSR.
@elycheea I added the following to my useDatagrid options object, but did not see any change. I also searched the carbon code base in github for autoResetGlobalFilter, and the only hit I got was from this issue. How should I try to enable it?
// Recommended by Carbon folks to prevent clearing of search field when modifying cols datagridOptions.autoResetGlobalFilter = false
I have side stepped the issue by tracking the searched text value in a useState and passing that into the TableToolbarContent in our DataGridActions
Hi @crichtonibm , Good to know you have found a workaround. Do we need to think of any alternative fix for you?
It would be helpful if you could share a minimum reproduction in code sandbox or stackblitz to analyse further and see how did you update the columns and why this issue caused.
FYI, you can pass autoResetGlobalFilter = false
to useDatagrid()
as below
This issue is stale because it has been open for 7 days with no activity. Remove the stale label or add a comment, otherwise this issue will be closed in 7 days.
What package(s) are you using?
Detailed description
Using latest IBM Products, and doing server side fetch for data using DataGrid. The infinite scrolling is working well for the most part. But big gap exists with searching. When I enter some text to search, the new data comes down and so I have to recalculate the required widths for the columns. In order for any changes to take affect, I then have to update the columns on the DataGrid. Doing that causes the search bar itself to be reinitialized, leaving me with searching in place, but to real way to clear it, or continue modifying that search.
DataGrid with infinite scroll and virtual data
I would expect that updating the columns would not clear the search bar or its current contents
FF/Chrome/Edge