Change url parameter with state manager in routing

Currently we are filtering data on our page, using url parameters which we change with buttons on the page. Using the state management we change the parameter without page load. However we’d like to be able to use state management to change url parameters defined like: /page/:parameter the same way. This is currently not possible, the only way to change this is to use the go to url action, but it reloads the page, which is not nice.

I’m not aware that this is currently not possible. I do really need this functionality. Voted.

1 Like

Well just create a link with the dynamic parameter in it. So add the dynamic attribute link with expression like:

/detail/{{some_id}}

So the routing does indeed work with state management? I don’t have pro license yet so am unable to test it but this is definitely a functionality that I need for my future project using Wappler.

No, what George suggested is using a link instead of changing the parameters with the state managemer.

1 Like

Just to confirm: what @swf requested is not currently possible - because using a link will cause the page to be reloaded - so this request is still open. Is this correct?

yes.

Thanks. I thought this was the case, but at a glance it looks like the issue was dealt with. I think it’s an important request.

I think there are some other improvements which could be made in relation to parameters and routing.

2 Likes

Will this be implemented?

Your prompt reminded me about other features which would be useful in relation to routing and URL parameters.

I’ll often have a page showing results from a single query (ie a single action file), where the search parameters come from different sources. Eg there might be a keyword search form, one or more dropdown menus displaying categories and perhaps an advanced search. In the case of the menus, it would nice to be able to use routing - which in itself would be straightforward. However if the user then wanted to use a keyword search, I don’t think it’s possible to remove the path parameters left over from the categories - so it’s not possible to use routing at all in such pages (unless, hopefully, there’s some method I haven’t thought of).

Eg if a rewritten URL looked like /fashion/france/ and then, on the same page, a user wanted to use a keyword search resulting in a query string such as ?keywords=paris fashion 1923, I don’t think this is possible, because the rewritten URL will remain and the query will fail. As far as I know, query manager (in App Connect) can only add/remove name-value pairs.

There have been a couple of questions about removing all parameters from a query string - eg in this question from @transcoderm. Such a feature would be very useful - and solve this and one or two other problems.

Any news on this?

1 Like

We’ve implemented routing with the current options here:

it works (click on the document’s category filters) but it reloads the page each time. I don’t think it makes sense to have a modern dynamic tool which refreshes filtered data without page reload out of the box but requests “old style” page reload because of missing routing implementation.

George, please implement state manager support in routing. Thanks.

3 Likes

Perhaps it can be implemented ala history.replaceState and or history.pushState in javascript. Been reading about it before but have no to time to test it out.

That is actually not true. App Connect has a smart page routing built-in that will catch all links to routes and will automatically refresh only the routing regions inline!

So even if you have full routing links - app connect will do local refresh if the routes are defined on the same page of course ( can be dynamic routing content regions)

Yes that is exactly what App Connect is using

George, we do not use page routing here, we just want to filter data based on the url, not to use page routing.

1 Like

Andre that is exactly the case for page routing. You define an area with the routing component, and define its url parameters.

Then within this area, when the url matches, you can use the routing parameters and filter your data accordingly.

Maybe @Teodor have an example with step by step usage.

George. That does not make any sense just having a table with data and just filtering it. It would if I’d want to change the kind of content, like swichting from table to card view (as we’ve done here: https://www.unserozeanium.ch/ueberuns/mitglieder).

You suggest leads to unecessary complicated design/structure. Why don’t you just extend state manager with routing? That would be the logical way to implement it.

When you have routing on your page then App Connect also registers a special link component. All link tags <a> will support routing, when a link starts with ./ then App Connect will know that it is a route link and it will use the history.pushState to update the url without reloading your page. So it has a build-in state manager.