DataTable: Count rows in table across changing server data and datatable filtered data #2012
Unanswered
SolidAnonDev
asked this question in
PrimeReact
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have kind of an in depth set of filtering mechanisms because I am providing some custom "filters" that are provided to the server to filter data directly from the server and provide it back. These are in a different component that is external to the datatable and has nothing to do with datatable functionality.
Then there is the "column" filtering that the datatable is capable of on the client.
In my situation, I have an array
data
that contains the data as it came from the server.I then used the values from the
onValueChange
prop provided by the DataTable to keep track of filtered data in another array:filteredData
.The problem is I want to display a count of all rows in the table as it changes. If I use my array,
data.length
, then the count won't update when the user creates some DataTable filters (column filters).However, if I use
filteredData
, then the count won't update when the server data changes, it stays stuck on thefilteredData.length
count. This would be when the user changes the 'server filters' that I provide external to the datatable.In any event, I'm looking for a better solution to this, is the datatable capable of providing this information? I suppose I don't mind doing something a bit 'hacky' if that's all is availab.e
Beta Was this translation helpful? Give feedback.
All reactions