Applying card filters using t.navigate()

Hi Folks. I have a t.popup() from a board-button that is a popup list. When I select one item I want to apply a specific set of filters. Setting the url property to an URL works great, but opens a new window. So I thought a callback with t.navigate() would make sense.

When t.navigate(board.url + "?filter=label:ABCD") is called, the URL briefly changes as expected, but the filter is not applied and momentarily the URL is changed back to the board url without parameters.

Did I miss another method that would apply filters, am I doing it wrong, or is this a bug?

I haven’t used t.navigate yet, but my impression is that it’s used to only navigate to a board or card, not to set filters and other stuff along with it.

The docs do say “Lets you tell Trello to navigate to an arbitrary Trello URL”, stating boards and cards only as examples. I’ve tested a few other trello URLs and they seem to work.

Is there maybe some workaround that would allow me to circumvent the API?

Interesting! I’ve been playing around with this to better understand what might be happening under the hood. You can play around with a live sample of it here: Trello. It looks like the filter is applied correctly if you .navigate to a board other than the one you are on.

However, the filter does not stick around if you .navigate to the board that you are currently on. I believe that this is the result of the web client trying to be smart and not wanting to re-draw the page because the URL (sans query parameters) has not changed.

At this time there isn’t a way I can think of to force a reload in the way that you want to get the filter to stick around. We have an item in our long-term backlog to tackle interacting with filters in Power-Ups, but it isn’t something that is currently prioritized.

Thanks for the reply! Too bad interacting with filters isn’t prioritized, this would be very helpful for us. I’m wondering if there is maybe a workaround, or an easy fix to use t.navigate. I’ve tried to use a different url to the same board (https://trello.com/b/<full id of the board>) with those query parameters but that didn’t seem to work. I also tried to navigate away and setTimeout to navigate again but that was a longshot :slight_smile:

I see that the navigate action passes off to Backbone.history.navigate in Trello, from what I read it seems to be possible to make the routes accept the additional parameters. But then again, I shouldn’t be making assumptions without seeing the rest of the code :slight_smile:

Anyway, I’d appreciate if you could check with your team if there is maybe an easy fix that could be prioritized. It would mean a lot to me!