Feature: find page open locations
Feature: find page open locations by Arjan van IJzendoorn
Mendix 5.13.0 brings with it a new feature: in the find advanced dialog you can now search for places where pages are opened. What makes this search special is that it will also show you in what location the page is opened: in content or in a (blocking) pop-up.
You can open the find advanced dialog by choosing
Find advanced... or by pressing
Ctrl+Shift+F. Choose ‘Page open locations’ and you can search for the occurrences of a single page or of all pages based on a given layout.
The find results will include a column indicating the location where the various pages are opened:
The reason for building this feature is helping in converting legacy layouts, i.e. layouts that have the property ‘Use main placeholder for pop-ups’ set to ‘Yes’. The rest of this article is about this property.
Use main placeholder for pop-ups
After converting a project from Mendix 4 to Mendix 5, you will get the following warning concerning the DesktopLayout:
Using the main placeholder contents for pop-ups is deprecated. This option will be removed in a future version. Please use a separate pop-up layout instead.
I want to talk about what this message means and how to get rid of it. To do this, we first need to discuss the situation of layouts in Mendix 4.
Mendix 4 had no explicit layouts. You would simply design the contents of the page and the header with the menu bar would magically appear above those contents in the browser. Only if you were an HTML wizard, you could modify index.html and change aspects of this layout. In short, life was simple but limited.
This simplicity meant that a page could both be used in content and as a pop-up. Our web client would magically add the header if the page was shown in content and it would refrain from doing so in a pop-up.
In Mendix 5 we made layouts explicit and editable. You design not only the contents of the page but also where the menu bar appears, whether there is a header or footer and so on. This means we put a lot more power in the hands of the business engineers to create attractive applications.
You can read more about layouts in the following post: https://www.mendix.com/blog/designing-flexible-user-interfaces-layouts/
Pop-ups have layout, too, and this means that we now have a challenge in converting Mendix 4 to Mendix 5 projects.
Conversion from Mendix 4 to 5
When converting a project from Mendix 4 to Mendix 5, we had to do something to keep the magical behavior of the header appearing in content, but not in pop-up. To do this, we add a layout called ‘DesktopLayout’ to your project during conversion. This layout simulates the old behavior by using the property ‘Use main placeholders for pop-ups’.
If this property is set to ‘Yes’, pages based on this layout will exhibit the old Mendix 4 behavior. If you open such a page in content, the whole page including layout will be rendered; if you open it in pop-up, only the contents of the main placeholder will be shown.
In this way, we maintain the Mendix 4 behavior and you do not have to deal with making layout explicit immediately. However, the property ‘Use main placeholders for pop-ups’ is deprecated and sooner or later you will need to get rid of its usage to allow conversion to the next major version.
Getting rid of the deprecation warning
Simply setting the property ‘Use main placeholders for pop-ups’ to ‘No’ will make the warning go away. However, if a page based on the layout is shown in pop-up, the whole layout will be rendered in the pop-up and this is unlikely to be what you want to happen.
Instead you check the locations where a page is opened and draw conclusions based on that:
- If a page is only used in content, you can set the property to ‘No’ and be done with it.
- If a page is only used in pop-ups, you can base the page on the layout you use for pop-ups instead. Then throw away everything that was not in the main placeholder.
- If a page is used both in content and in pop-ups, you will have to duplicate the page: one copy for opening in content and one for opening in pop-ups. Choose the appropriate layout in each case.
Hopefully, you will find few or no pages that are used in both ways!
To find the locations where a page is opened, you can, of course, use the new find advanced query that was discussed above. Take note that you will not find page open locations in custom widgets or in Java code.
I hope this article clears up the layout deprecation warning and will help you in getting rid of it. Happy modeling!