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

Activate filtering programmatically #85

Open
revett opened this issue Dec 21, 2021 · 6 comments
Open

Activate filtering programmatically #85

revett opened this issue Dec 21, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@revett
Copy link

revett commented Dec 21, 2021

Problem

I'm looking to enable filtering for my github.com/charmbracelet/bubbles/list component by default so that as soon as the list is rendered I can start to type, without needing to press the filter shortcut (/) first.

Recreate

  • Use the list-default example within the charmbracelet/bubbletea repo
  • Set m.list.SetFilteringEnabled(true) on line 82
  • Note that this does not do anything

I'm relatively new to the package so I think this needs to be done at a different point within the model lifecycle, rather than at the point of creation. Any help would be great 👍

@meowgorithm
Copy link
Member

meowgorithm commented Dec 21, 2021

Hi! SetFilteringEnabled is actually for enabling and disabling filter functionality, not quite for triggering filtering. Based on my quick skimming of the code think we’ll need to add a method for you to be able to activate the filter programmatically.

Anyway, it’s a good idea, and we should definitely add it (surprised we haven’t, actually), though it will probably happen after the new year.

@meowgorithm meowgorithm changed the title EnableFiltering by Default Activate filtering programmatically Dec 21, 2021
@meowgorithm meowgorithm added the enhancement New feature or request label Dec 21, 2021
@joaom00
Copy link

joaom00 commented Mar 20, 2022

@meowgorithm Any update around this?

@akgunberk
Copy link

akgunberk commented Apr 6, 2022

I am facing the same issue. I just want to view filter input with a different key msg and use it for another purpose rather than filtering. But no way to achieve this. m.list.SetShowFilter() doesn't work and does not replace title. Any news on this issue?

@usrme
Copy link

usrme commented May 12, 2022

Same thoughts as @akgunberk: I would ideally just want to co-opt the same screen space the filtering currently takes up, but activate it with a different key and then just capture the input without any filtering.

@bashbunni
Copy link
Member

Hey @revett I believe this is fixed in #335 - could you please let us know if this is still an issue? It sounds to me like it's the same feature request

@HiImJulien
Copy link

I did some detective work: #335 indeed fixes this. However the PR was merged after v.20.0 was tagged and is therefore not available for bubbletea v1.

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

No branches or pull requests

7 participants