cljfx

acim1 2022-05-12T00:09:42.943259Z

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?

vlaaad 2022-05-13T07:42:55.625149Z

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

vlaaad 2022-05-13T07:47:53.661499Z

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

acim1 2022-05-13T15:29:22.519919Z

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

acim1 2022-05-13T15:44:44.013989Z

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

vlaaad 2022-05-13T17:05:26.232689Z

Yeah, caching magic :)

acim1 2022-05-12T00:10:57.934059Z

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