Fork me on GitHub
#cljfx
<
2022-05-12
>
acim100:05:42

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?

vlaaad07:05:55

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

vlaaad07:05:53

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

acim115:05:22

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

acim115:05:44

It's working plenty fast...so I think it must be working the way I think it does/want it to. https://giphy.com/gifs/travisband-excitement-thats-cool-this-is-Wo6W02pf1HMsAljJ8X

vlaaad17:05:26

Yeah, caching magic :)

acim100:05:57

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