Add SetFilterText and SetFilterState
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.
This also addresses #85 but in a different way than #201
thanks for the tests (both manual and programmatic) @k-x7 !
@caarlos0 / @maaslalani any chance I could get this revisited?
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()
}
Hey, Is there a reason why this is not yet merged? I'd like to work on it if no one else is.
also interested in this one :/ anything that can be done to get this merged?