Data/Event Sharing Between Main & Content Page in SPA


We have been using SPA for our current project and its been great so far.
We had a few issues with JS, which have been reported and we’re waiting for a fix.

As the topic name suggests, this is another issue we are facing now.
On our index page, we have label which shows user’s progress across the content pages.
We have used Session to store and display the progress status, but it does not update real-time.
Session manager has been created on every content page and the index too, with same variables. But they do not get updated dynamically in the main page when changed from content page.

Similarly we also have to submit forms inside content page using a button that is on the main page. (This one sounds avoidable, but our process requires this.)

Another use case for us is that we would like to store values input by user on content pages and re-use them across all content pages in the main page. Similar to progress value.

I hope I have explained our requirement clearly. If not, please ask to clarify. :slight_smile:


@George / @Teodor Could you guys please help out with this?


with v1.9.4 sharing data via session seems to work between separate SPA pages - will be digging deeper and share further observations.


Have tested it out further. Sharing data between Main & Content page is still not working.
I have set two labels to show data from session using dmx-bind.
But if I update the value on main page, content page label does not get updated, and reverse is also similar.
Any thoughts on if this is even possible or should be possible @George / @patrick ?

Session values do keep in sync between content pages, just not with the main page.


A content page is injected in the main page so all data from the main page is available in it as it is part of it.

Only the data binding picker doesn’t show that yet but manually entered expressions should work fine.

You just have to make sure you use a full path expression - with all the objects prefixes in it.

SPA and Dynamic Attributes

Thank you for the direction.

Reading this got me thinking that creating session for every page is probably overlap and duplication.
So I removed session manager from all content pages, and just hard-coded session variables wherever required… because as you pointed, they are available, just not visible in the pickers.
And now, session values are being shared correctly. And the work flow is restored. :slight_smile:

@George I would bother you for one more thing - similar to session manager, what other components need not be added to content pages if they are common across the SPA?
Browser, Local Storage Manager… etc?


You only need these components on the parent page (main template page) where you include the views. You should not add them on every view page.


Which? Can you please share a list?


I am not sure i understand your question. None of the components should be added there, the views “read” them from the main page.
Just think about the view as parts of the main page. Do you add components on every part of your page, or do you only add them once per page? :slight_smile:


Which components among these 100s, do we not need to add to content pages?


Wow :slight_smile:
There is no such a list available. Please read my reply:

You just put the design components there in the views (parts of the page) - the rest like managing cookies, sessions etc. must be included once and not in every div(section, part) of the page.

1 Like

Hi @Teodor, I have been moving the dmx-serverconnect queries to the top of their relevant Content Pages. I have been doing that because in my mind they will only execute when that particular view is called. Should I not be doing that?

1 Like

That really depends on how is your site designed. If it is only per view you can move them there, if it’s a global action it must be on the main page.


OK great, I am happy with that :smile:


Is this fixed in 2.0.0 Beta 3?