my first view working perfectly there isnt any problem . But when I created new view inside other view . I cant catch url parameters…
What is wrong .?
I want to catch passed parameters from URL but always fail.
I have created “search” view. (called search) then I created new view inside search view ( transferclient view)
and I have created link inside search view
<a class="btn btn-sm btn-info" dmx-bind:href="./transferclient/{{clientid.value}}/"><i class="fa fa-arrow-right"></i> Transfer Client</a>
I can pass clientid value but I cant catch my passed value inside transferclient view . Because I cant add {{transferclient.params.clientid}} in transferclient view …
if I have add it in view manually . it doesnt work .
From what I see is that you have /search/:query/ as route path for the search view. And inside this route view you have /transferclient/:clientid/ as a route. This will not work.
The route path are all from the page root, when you want to nest routes you have to include the parent route in the path. So the transferclient route would have a path /search/:query/transferclient/:clientid/. Also important is that you uncheck the Exact toggle for routes that have sub routes.
With the above sample with the url /news/ it will show:
NEWS
INDEX
With the url /news/123/ it will show:
NEWS
DETAIL FOR 123
So the newsRoute will match all routes that start with /news/. The newsIndexRoute will match when the route is exact /news/ and the newsDetailRoute will match /news/123/ where the id must be a number.
This will not work, the outer route matches url starting with /news/. The inner route matches the url /detail/123/. The problem is that the outer route doesn’t match and will not render, causing the nested route also to be invisible.
Hi, @patrick, thanks for this post. I’m trying to comprehend routing for SPI.
I see you use kind of “nested” syntax for routes. Can you please explain the reason for that?
It seems like Wappler GUI doesn’t create nested ones, it puts one after another.
Would this syntax work?
<div is="dmx-route" id="newsIndexRoute" path="/news/" exact="true">
INDEX
</div>
<div is="dmx-route" id="newsDetailRoute" path="/news/:id(\d+)/">
DETAIL FOR {{params.id}}
</div>