Fork me on GitHub

I have a :table-view that I have a fx/sub-ctx function delivering the items for. There is potentially filtering going on in that function that could change the number of items (which can be changed dynamically by the user). Is there a convenient way to get the number of rows currently rendered in the table for informational purposes in another part of the UI (this can be pretty high/thousands)? Like a listener on the table for the size?


Not sure I’m following… You want to track visible rows.. inside the state?


or track count of items? for that, you can do (count (fx/sub-ctx …)), right?


Oh, that's right...the latter is actually a decent option. I didn't want to duplicate the work inside that function elsewhere (it's a massive filter/sort), but I forgot it is subscribe/as needed so it should be fine to have it in multiple places? i.e. where I need the results of that same function to get the table items, and in a different component where I need the count


It's working plenty I think it must be working the way I think it does/want it to.


Yeah, caching magic :)


I could rearrange things a bit (or probably more than bit...) to make it easier to gather that info, but I just need a count, so looking for a low-hanging solution