↓ Skip to main content
Four flat panels laid over a pale page, a teal square at the centre with two action bars beneath it, an orange square top left, a dark column on the right and a wide orange band below

Dialogs and Lookups Overview

Sooner or later a screen has to ask something, confirm something or let the user pick a record. Maximo Mobile gives you four surfaces for that, and the reference describes them as four unrelated elements. They are related, and one measurement across IBM’s shipped apps explains how they fit together.

MAS 9.2 series framework 3.2.8xx

This is the overview. Building a dialog and wiring a lookup each have their own guide, named at the end.

The proportions come from the apps that IBM ships with a 9.2-series install, as Application Configuration shows them. The pictures come from our own Components Explorer app, a small Maximo Mobile app we built for these articles. IBM releases about once a month, so details move and the proportions hold.

A lookup is a dialog with a datasource
#

Every <lookup> in the shipped apps carries a datasource attribute, with no exception anywhere. The attributes that lookups set fall into three groups:

  • Every lookup sets id and datasource.
  • Almost every lookup sets show-search and lookup-heading.
  • Most lookups set lookup-attributes, and many also set show-count, tight, width, border and height.

That first pair of attributes carries the whole idea between them. A dialog is a container that shows whatever you put in it, while a lookup is the same container with a list of records bound to it. It adds a search box on top and a way to hand your selection back.

A lookup is a dialog with records bound to it A lookup is a dialog with records bound to it
A lookup is a dialog with records bound to it

The attributes that follow say the same thing in more detail. lookup-heading names the column the user reads, lookup-attributes lists the fields to search across, and show-count puts the number of matches on screen. All three exist because the content is a query result.

In Maximo Mobile on a tablet, the lookup slides in from the start edge as a drawer. It shows the count, the search box and the records, and the page stays dimmed behind it. On a phone the same lookup fills the whole screen.

Maximo Mobile at tablet width. The lookup “Pick an asset” is open as a drawer at the left. Under the heading stand “8 records” and a search box, then a list of assets such as PUMP-101 Feed water pump, boiler 1, each row with a select button. The page behind it is dimmed.
A lookup with show-search and show-count, in Maximo Mobile at tablet width, in the preview of our MAF editor

The markup behind it comes from our Components Explorer app. The button names the lookup, and the lookup names its datasource:

<button id="fs_d_lookup_open_both" kind="secondary"
        label="show-search + show-count" lookup="fs_d_lookup_both"/>

<lookup id="fs_d_lookup_both" datasource="fs_d_lookup_ds"
        lookup-heading="Pick an asset"
        show-search="true" show-count="true"
        lookup-attributes="{['assetnum', 'description']}"
        on-item-click="pickRows" on-primary-action="pickRows"/>

show-count writes “8 records” above the list, and show-search adds the search box. With both set to false, the drawer shows the heading and the rows alone.

A dialog is mostly its action bar
#

What a <dialog> sets is almost entirely about the buttons along the bottom:

  • Every dialog sets id, and nearly every dialog sets a title.
  • Most dialogs set primary-action-text and on-primary-action.
  • Many dialogs also set secondary-action-text and on-secondary-action, and some set on-close-action.
  • A smaller group sets size, on-primary-action-arg and primary-button-disabled.

Most of the attributes that dialogs set belong to the action bar, so a dialog in this framework is a titled box with one clear action. Many also carry a second action and a close.

The primary label and the primary handler do not always come as a pair. Some dialogs label a primary button and hand it no controller method, which means the button closes the dialog and nothing else happens. That is a legitimate confirm-and-dismiss pattern.

Here is such a dialog with both buttons. On a tablet it sits in the middle of the dimmed page. On a phone it fills the screen, and the action bar moves to the bottom edge.

Maximo Mobile at tablet width. A dialog titled “Two buttons” stands over the dimmed page. It has a close icon at the top left, the text “primary-action-text and secondary-action-text are set.” and the buttons Cancel and OK at the bottom right.
A dialog with a primary and a secondary action, in Maximo Mobile at tablet width, in the preview of our MAF editor
<button id="fs_d_actions_open_two" kind="secondary"
        label="+ secondary-action-text" dialog="fs_d_actions_two"/>

<dialog id="fs_d_actions_two" title="Two buttons"
        primary-action-text="OK" on-primary-action="closeDialogs"
        secondary-action-text="Cancel" on-secondary-action="closeDialogs">
  <box id="fs_d_actions_two_c" direction="column">
    <label id="fs_d_actions_two_t" wrap="true"
           label="primary-action-text and secondary-action-text are set."/>
  </box>
</dialog>

Four attributes make the action bar. The two *-action-text attributes give the labels, and the two on-*-action attributes name the controller methods that run on a tap.

Opened far more often than inspected
#

The controller side is lopsided in a way that tells you how to think about a dialog in the first place. Three calls matter, from the most used to the least used:

  1. showDialog opens a dialog by id.
  2. findDialog gets the dialog object.
  3. closeDialog closes it.

Code opens dialogs clearly more often than it goes looking for one, and the lifecycle hooks are rarer still. dialogInitialized is implemented in some apps, while dialogOpened and dialogClosed appear only in a few.

Read that as guidance, because a dialog is usually a thing you open by id and let the framework manage. Reaching for the object itself is the exception, and it is worth asking why you need it.

The drawer, the flyout and the panel
#

SurfaceWhat it is
<dialog>a titled box over the page, with an action bar
<lookup>a dialog with records bound to it
<panel>one view in a stack, swapping the page content in place
<sliding-drawer>slides in from the edge and leaves the page visible
<flyout>a small popover anchored to what you tapped

The sliding drawer comes in from the edge and leaves the page visible behind it. It is a real option and a minority one, suiting a filter panel or a set of options the user adjusts while watching the list change.

The flyout is a small popover anchored to what you tapped. It is close to unused in the shipped apps, so treat it as available and unproven.

The panel sits in the page itself and overlays nothing. It sits in a stack, one showing at a time, and swaps the page content in place. It is more common than the lookup, and Layout with Containers covers it there as the container it really is.

This drawer comes in from the end edge. The page stays in view behind it, dimmed, and that is the reason to pick a drawer over a dialog.

Maximo Mobile at tablet width. A sliding drawer titled “Sliding drawer” is open at the right, with a close icon, two lines of text on a grey box and a Close button. On the left the page “sliding-drawer: variants” stays visible and dimmed, with its list of drawer variants.
A sliding drawer with align end, in Maximo Mobile at tablet width, in the preview of our MAF editor
<button id="fs_d_drawer_open_end" kind="secondary" label="align: end"
        sliding-drawer="fs_d_drawer_end"/>

<sliding-drawer id="fs_d_drawer_end" header-text="Sliding drawer"
                align="end">
  <box id="fs_d_drawer_end_c" direction="column" background-color="ui-02">
    <label id="fs_d_drawer_end_t1" wrap="true"
           label="Drawer content. The grey box shows the space around it."/>
    <button id="fs_d_drawer_end_close" kind="secondary" label="Close"
            on-click="closeDialogs"/>
  </box>
</sliding-drawer>

align picks the edge: start is the left side in a left-to-right language, and end is the right side.

Choosing between them
#

The situationThe surface
Confirm, warn, or collect two or three fieldsa dialog
Let the user pick a record from a lista lookup
Filters or options the user tunes while watching the pagea sliding drawer
A second view of the same record, replacing the contenta panel
A small menu anchored to one controla flyout, knowing almost nobody has used one

The question that settles most cases is whether the user needs to see the page while they decide. If they do, use a drawer. If the decision replaces the page for a moment, use a dialog.

What to read next#

  • Dialog Implementation and Lookup Implementation are the members-only guides that take these two apart, covering the action callbacks, the lifecycle, the selection return and the measurements behind this page.
  • Buttons and Actions for the buttons that open a dialog with no controller at all.
  • Layout with Containers for the panel and the stack it lives in.