How to implement filtering based on temporary UI state?
For example: i have a helper function that return cursor to a list of items. I pass this helper to a html select multiple that represents items list.
Then users can select multiple items in html select, then click a button to perform some operation on selected items. I obtain the list of selected items directly from html via $(‘select’).val();
Then i decided to isolate this template as a reusable component. As i’m using a component template i avoid direct access to a component html outside of component. But i need to know which items are selected. What i do now is fetch cursor into a reactive array of items, pass this array as data to a component alonngside with a callback for “click selectOption” function. The callback sets a special ‘selected’ flag in a reactive array. This way in a main template i always know which elements are selected.
But this approach has a big disadvantage- i actually fetch items data.
Are there any other ways?