Tutorial 7 Navigation from LIST Control

What you will learn in this Tutorial

How to Navigate from list item to the same next screen with corresponding data

How to Navigate from each list item to different screen

Download Source Code - Tutorials - Source for this tutorial is in appemble-tutorial-list
Learn more FAQ

Must Read

Tutorial 6 How to create a list

Good Read

Tutorial - How to create a searchable list

Tutorial - How to create a section list

Reference LIST control

Introduction

In this tutorial you will learn how to call screens from list items of a LIST control. Pre-requisite for this tutorial is Tutorial 6 How to create a list

Two types of navigation are possible

  1. Screen A to Screen B with corresponding data in Screen B when a list item is tapped in Screen A. On tap of any list item in the LIST control of screen A, you always go to Screen B but with different data.
  2. Screen A to Screen C, Screen D, Screen E, Screen F, based on which item is tapped in Screen A

Download and Run Tutorials

This chapter uses source code from appemble-tutorial-list. If you have not downloaded tutorial source code, click on Download Source Code - Tutorials

Android - Right click on appemble-tutorial-list and click on Run as Android application.

iOS - Select scheme appemble-tutorial-list and iPhone x.x simulator. Click on Product -> Run.

FAQ

Is it necessary to pass parameters from list action to another screen?

If you want the next screen to take some values from the list item, then passing parameters in the target parameter list is a the only way. If the next screen does not need any values passed from the list item that triggered it, do not pass any parameter.

How can I add two actions to the same list item?

You can define cascading actions - In XMADL if an action is defined inside another action, it is called a cascading action. For example, in the control below, the CLOSE_SCREEN will be called when the NEXT_SCREEN is complete.

<control type="PUSHBUTTON" x="0" y="1" width="16" height="8" default_value="Back"
      appearance_name="grey_button" data_type="VARCHAR">
    <actions>
        <action event_list="TAP" action_name="NEXT_SCREEN" target="specialnavlist">
            <action event_list="TAP" action_name="CLOSE_SCREEN"/>
        </action>
    </actions>
</control>

Or you can define two actions at peer levels. For example, in the control below, the CLOSE_SCREEN is called right after NEXT_SCREEN. If NEXT_SCREEN has some code that runs in a background thread, the CLOSE_SCREEN will not wait for the background thread to be complete. In other words, it is possible that the CLOSE_SCREEN gets completed before the NEXT_SCREEN finishes its execution in the background thread.

<control type="PUSHBUTTON" x="0" y="1" width="16" height="8" default_value="Back"
    appearance_name="grey_button" data_type="VARCHAR">
    <actions>
        <action event_list="TAP" action_name="NEXT_SCREEN"
            target="specialnavlist"/>
        <action event_list="TAP" action_name="CLOSE_SCREEN"/>
    </actions>
</control>

When I pass a parameter from Screen A to Screen B, can I have a different field_name in the screen A and Screen B?

Yes you can have different names. For example in Screen A the field_name = “screen_name”. And in Screen B you want to give field_name=”s_name”. In the action in screen A, you have to specify input_parameter_list=”screen_name” target_parameter_list=”s_name”. Screen B, must have a control with field_name=”s_name”.