Does dmx.parse work when the serverconnect located inside Content Page?

I couldn’t get dmx.parse to work when the corresponding serverconnect is located inside Content Page. Can anyone confirm if this is the case. The reason I have the serverconnect inside the Content Page is because It’s only being used by that particular page. The serverconnect works perfectly except I couldn’t get dmx.parse to work until I moved the serverconnect inside the Main Page.

Components are accessible based on how DMX creates a structure for it.
To check this, you need to use dmx.app.data which returns the complete current structure of components.
In your case, the server connect inside content page is inside the content component.
So something like dmx.app.data.content.sc1 would return your the server connect component.
Once you have the PATH of any component, you can also call it from dmx.parse like so:
dmx.parse('content.sc1.data..')

dmx.parse always works directly on the root page. So anything nested inside a route/content, modal, collapse, CR, form etc will require passing of complete path.

NOTE: Using dmx.parse or dmx.app.data for REPEAT components is not recommended. Last I tried it gave weird results every time - mostly I think because it gets generated in runtime and can change frequently.

3 Likes

Thanks for the insight but I’m not clear exactly how to check the structure of components. Is content in your example means the name of content page, appid, or the file name?

content here could be just content if you can see it in dmx.app.data (I think in nodejs).
Else, it would be route name (I think in SPA). Or it could be index (Also in SPA). I don’t have a written set of possibilities… but have seen these 3 as far as a I remember.
If you have a link to share, I can try to find the server connect’s path for you via console.

@patrick is the guy who knows how this works.

That it is. Thank you.