I have a custom built widget that scans heading elements and builds a navigation bar for them. The widget is placed on a sticky container on a page within a data container. When I first navigate to the page with the widget from the homepage it works fine. But when I navigate back to that page, either from the page itself or from another page, then it breaks. It seems that the widget breaks because it is detecting a double up of the same page. However I cannot see that represented in the html. My questions are: Does mendix hide and stack pages instead of replacing pages? Can I, not only refresh the page (which is the easy part), but also navigate to that page?
The process of page navigation looks something like this:
New page starts to load
Content for new page is loaded into an invisible <div> with a class like mx-incubator
Once complete, existing page content is unloaded
Then content for new page is moved into the visible page content <div>
So there is a point in time when your widget first initializes that it can see both pages. You should be able to target just the new page by locality – something like jquery’s closest() function targeting something like the mx-page class.
because it is in a dataview with a singple object, and all objects should have an ID (right?)
would it be possible to save the ID in your widget, and then on reload, check if the ID is the same, if not, rebuild the nav?
no idea, if widgets have access to object IDs ? someone here should know :D