Change url parameter with state manager in routing

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.

@patrick This is only possible when hosting your site on Apache with the htaccess file to write the rules to? Will there be Apache independent routing in future? That we can use with Electron with FW7?

FW7 has its own routing and also uses the history.pushState. No .htaccess needed there and already supported in Wappler.

@Patrick I don’t understand what you mean. How do I implement this? I have this link:

dmx-bind:href="/lesen/{{FILEKATID}}/{{Filekategorie.slugify()}}"

and this routing:

Path: /lesen/:FILEKATID/:filekategorie?
URL: /lesen/index.php

What do I have to chnage?

Route paths should start with ./. Have you tried dmx-bind:href="./lesen/{{FILEKATID}}/{{Filekategorie.slugify()}}"