bubbles icon indicating copy to clipboard operation
bubbles copied to clipboard

Add SetFilterText and SetFilterState

Open taigrr opened this issue 2 years ago • 6 comments

Currently, there's no way to allow a developer to prefill a list filter reliably. A workaround of using Program.Send works, but is limiting.

This PR introduces two new functions, SetFilterText and SetFilterState which fix this issue and allow for finer control over the list's initial filter state.

Willing to make whatever style changes etc. are required.

taigrr avatar Feb 21 '23 09:02 taigrr

This also addresses #85 but in a different way than #201

taigrr avatar Feb 21 '23 19:02 taigrr

thanks for the tests (both manual and programmatic) @k-x7 !

taigrr avatar Feb 22 '23 00:02 taigrr

@caarlos0 / @maaslalani any chance I could get this revisited?

taigrr avatar Sep 26 '23 05:09 taigrr

This implementation does not set the filteredItems list to be the whole list when the state is set to Filtering and the FilterInput has empty string as value. I would add the same code found in the switch to the Filtering state by key press:

if m.FilterInput.Value() == "" {
  // Populate filter with all items only if the filter is empty.
  m.filteredItems = m.itemsAsFilterItems()
}

lorenzo-milicia avatar Sep 27 '23 11:09 lorenzo-milicia

Hey, Is there a reason why this is not yet merged? I'd like to work on it if no one else is.

ajayd-san avatar Jun 19 '24 06:06 ajayd-san

also interested in this one :/ anything that can be done to get this merged?

aexvir avatar Aug 05 '24 13:08 aexvir