-
Notifications
You must be signed in to change notification settings - Fork 27
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
feat: custom filter text #116
Comments
Agree this is a useful/reasonable feature, and I think the interface approach might be the nicest for all involved. That would allow you to inject whatever behavior/checks you want and just make sure it's spit out with |
I lied, the interface approach would not have been the nicest for the table itself. There are a lot of additional checks that are done that make this unfortunately difficult. Fortunately a very easy fix is to just expose the set function, which is what #117 does. Released as v0.14.3, let me know if that works for you. If it does, feel free to close the issue. If you think we need to do more, let's keep this open and discuss. |
Hmm, did you use |
Though that is generally some strange behavior that you're showing in that gif regardless. Even if |
Yep! |
Got it, I'll have to take a look when I get some time. Sorry about that, I was relying too much on the added test rather than trying to construct a whole example and clearly something got mixed up somewhere. |
Ok, the filtering part was my fault. I didn't realize I had to set I do still see the odd coloring at the bottom -- not sure if that's an issue on my end or not: Just made the source public: https://github.com/lrstanley/hangar-ui/blob/master/internal/ui/view/targets.go#L42-L52 |
Ah, that makes sense! Glad it's working. For the color, it appears to be tied to the cursor of the filter. I'm able to reproduce color reset when the cursor blinks in and out. I think the cursor itself is resetting the style somehow, I'll investigate a bit more. |
Turns out the cursor is accidentally injected when setting the text input value directly, so it needs to be reblurred. This should get rid of the block cursor for you and fix your issue, though there's a lingering issue that I'm going to make another github issue for as a separate problem. Released as v0.14.4, try that and see if the color issue is fixed for you. Additionally, you may want to use a static footer to get rid of the filter text appearing, but up to you - I can see it being useful either way. |
I actually set a static footer, but it seems like it doesn't apply in some circumstances -- will test that more later today. I think it's because the way I currently have it setup, sometimes it's empty, which makes the default one render. If I add pagination into it, it'll probably override and continue to be used. Will test out the fixes later today and will let you know. Thanks! |
Issues have been fixed. I also noticed that |
Yes that's some unfortunate naming that slipped in early on. It's intended for all rows that are actually included in the table's view (filtered/sorted), and paging is applied on top of that. |
Hello again -- as shown in #115 as an example, my app layout includes a "command bar" that can both invoke commands and filter views. I plan to support a bunch of functionality within this input that is not just a plain search string (e.g. the ability to also use
key=value
or!shebang
type entries). Due to this, directly exposing it to bubble-table won't work, as theValue()
output won't be what I'm looking to filter with. The way my usecase works, is it sends a message to all components through the app, with the filter text when it changes, allowing each component to individually filter based off the specific usecases of each component.What would be awesome to have supported, is a field that lets me specify the actual text for filtering, where
""
is no filtering, and anything else would be used as filtering. With this, I would be able to support key-value type filtering, but also regular text filtering.Alternatively, loosening the restrictions on the
WithFilterInput()
method, to utilize an interface ofValue() string
, and selectively interface checking for other features likeFocus()
, so it only calls those if the underlying type has those methods.Thoughts?
The text was updated successfully, but these errors were encountered: