Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SetFilterText and SetFilterState #335

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

taigrr
Copy link

@taigrr taigrr commented Feb 21, 2023

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
Copy link
Author

taigrr commented Feb 21, 2023

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

@taigrr
Copy link
Author

taigrr commented Feb 22, 2023

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

@taigrr
Copy link
Author

taigrr commented Sep 26, 2023

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

@lorenzo-milicia
Copy link

lorenzo-milicia commented Sep 27, 2023

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()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants