In this how-to, you will create and configure the home page as well as the new and edit pages.
This how-to will teach you how to do the following:
- Build the to-do app pages
Before starting this how-to, make sure you have completed the following prerequisite:
3 Creating the Home Page
When users open the to-do app they will land on the homepage of the app. Follow these steps to create and configure the home page:
- Right click your newly created ToDo module and select Add > Page.
- Go to the Phone Specific tab and click No when you’re asked to create a new Phone Profile.
- Name the page Home_Phone_Default.
- Select Phone_HeaderOnly as Navigation layout.
- Click Blank on the left side and select the Blank page template.
- Click OK to create the page.
- Open the HybridPhone profile available in your project’s Navigation and set the Home_Phone_Default page in the ToDo module as default home page.
- Change the Home menu item so that it also directs to Home_Phone_Default page in the ToDo module.
4 Configuring the Home Page
Let’s create the user interface for the home page so that it shows a list of available to-do’s. Follow these steps to set up the user interface and connect it to the new entity in the domain model:
- Open Home_Phone_Default page you’ve just created in the ToDo module.
- Change the page title to My to-do’s in the Properties pane on the right side of the Modeler.
- Remove the Layout grid from the page.
- Right-click the area you just cleared and select Add widget > List view to add a List view to the page that will take the place of the layout grid.
- Right-click the List view and select Select data soure.
- Click Select and select the ToDo entity for the Entity (path).
- Click OK and then Yes to automatically fill the content of the list view.
- Remove the Completed attribute.
Double-click the Sort order: (default) and add the DueDate attribute with the Ascending sort direction.
Great! You can now see a list of to-do’s on your home page, but only after you have created them. Let’s configure a page to create to-do’s.
Users also need to be able to add new to-do’s to the list, that’s why you’re going to add a page that lets them do this. Follow these steps to create a new and edit page:
- Add a Create button to the HeaderRight placeholder on the page.
- Select the ToDo entity in the pop-up.
- Right-click the New button and select Generate page.
- Select Form default and click OK.
- Right-click the New button and select Go to page.
Delete the Completed attribute.
Run the app locally. Click Save and continue if you did not save your page(s) yet.
Click Yes to create a default database if this is asked.
Open the View App dropdown and select View Hybrid Mobile App.
Select the Profile profile and click the iPhone form factor for Preview in browser.
This is an easy way to see your app. There is also a way to simulate the touch behavior of a user on a mobile device. This is explained later on in this how-to.
For the next step in this series, move on to How to Create a Mobile To-Do App Step 3: Improve the Look and Feel of the App.
6 Related Content
- How to Build a Mobile To-Do App Step 1: Create a New Project, Module, and Domain Model
- How to Build a Mobile To-Do App Step 3: Improve the Look and Feel of the App
- How to Build a Mobile To-Do App Step 4: Add Logic to the Microflows
- How to Deploy Your First Hybrid Mobile App
- How to Publish a Mendix Hybrid Mobile App in Mobile App Stores
- Push Notifications