Dynamic Data Not Showing in SPA View

I am at my wits end here. I have a list view that goes to a details view in a SPA but for some reason the variable is not being passed and the page is blank. I have worked on this for days I am obviously missing something. Any help would be appreciated.

http://kopar.workbcpg.ca/press

Click on any of the detail links.

When I look _press.php, I see that you have placed the the data source inside the partial document

<dmx-serverconnect id="pressreleases" url="/dmxConnect/api/press/presslist.php" dmx-param:limit="3"></dmx-serverconnect>

The problem is that this instruction does not get executed because there is no trigger to do so, i.e. there is no full page load.

I have found that the best way to dynamically populate the partial document is to place the instructions in the main document.

Have a look at the example in this post Spa page calling unused server connects where I load all of the info from the database and used Data View to filter the required information.

This method can be used where the database table does not contain more than about 3,000 records.

The press list isn’t the issue though. It shows the list just fine. I just can’t get it to pass the variable to the detail page?

Sorry, getting ahead of myself, the problem with the detail page is what I should have pointed to.

I still think that pursuing the method used in the example will alleviate the problem. But instead of placing the instruction in the main page, place it in the _press.php page.

Thanks Ben, the link you provided is way over my level of knowledge. Perhaps I should be using a data detail region instead of a URL Parameter?

Here is what I have for a route:

<div is="dmx-route" path="/pressdetail/:story/" url="/_pressdetails.php" id="pressdetails"></div>

And here is what I have for a link to the details view:

<a class="btn btn-block btn-outline-success" href="#" dmx-bind:href="./pressdetail/{{id_press}}/"><i class="fal fa-newspaper">&nbsp;&nbsp;</i>Read Full Article</a>

Does that look right?

Hi Brad,
Everything is well setup on your pages.
It’s just on the view page, where the server action is, change:
dmx-param:story="query.story"
to
dmx-param:story="params.story"

Thanks Teodor! Works like a charm now! :slight_smile:

1 Like

Hi guys, not quite sure where this comes in?

I'm using SPA pages. I have set up a route on my source page

image

I have then set up on the same page a dynamic A tag

image

which when clicked on in a browser,

image

goes through to the right page with this in the address bar

image

but I'm not quite sure what to put on the target page to show the correct record. @brad's link in the original post no longer works and so I can't see anything there.

Also, could I set it so that the link goes to a master-detail page and select the correct target like this

Just need a bit of guidance please.

On your “view” page with details, where you set your details server action and set the value to the get parameter, use:

dmx-param:your_get_parameter="params.people_id"

Instead of

dmx-param:your_get_parameter="query.people_id"
2 Likes

Sorry @Teodor, I still can't figure this out. This is my code at the top of my target page showing the Server Connect and Data Detail.

Your suggestion of

dmx-param:your_get_parameter="params.people_id"

doesn't fit in with what I have.

Not sure how data detail/detail region has something to do with the initial topic, which is about filtering a query using an URL parameter.
Can you explain what are you trying to do and what is data detail/detail region used here for exactly?
Are you even sure you need detail region in your SPA page and not just filter a query on the child page?

This topic talks about routes and SPAs. Maybe I misunderstood but I thought it was passing an id via the route path. So in my example above I have a source page (A page with company details and list of contacts) with a link, that link takes us through to a second (the target) page which has a full list of contacts with a data-detail table to the side.

I wanted to click on contact, in this case ‘Chris’, which would then take us through to the target page and display the details of Chris. This page just happens to be a master-detail type page.

Does that make sense? Am I off topic?

Well, it won’t work with detail region. Detail region should be used with a repeat region on the same page. Not using URL parameter!

From what I understand what you need to do is a database query, which is filtered by an URL parameter.

Data detail region is never used on a separate page.

1 Like

Thanks @Teodor, I can change what I was doing now that I know. :smile: