Hooking Data Controls to ControlBar Disclosures

Description

You can display standard UX controls (such as Lists, Buttons, Input controls, etc.) in a disclosure. This means you can use controls to create menus, maps, ink surfaces, etc... that pop up at the click ok a button in a ControlBar.

images/list.png
A List Control inside of a Disclosure that opens via a disclosure button.

For a explanation on how this is done follow the guide below and/or watch this video.

Create a Component with a ControlBar and List Control

  1. In the UX Builder open the UX Properties page and click the [...] button next to the 'Style name' property.

    images/hook.png
  2. From the 'Location' menu select 'System' and from the style options select the 'Alpha' style. Click OK.

    images/hook2.png
  3. Open the UX Controls page and check the 'Mobile' checkbox.

    images/hook3.png
  4. Open the 'Panel' menu and select the [Panel Card] option to add a Panel Card to the component.

    images/hook4.png
  5. Highlight the Panel Card in the tree. Open the Containers menu and click on the [Container] option.

    images/hook5.png
  6. From the Container Type list select 'PanelHeader' and then click the 'Insert After' button.

    images/hook6.png
  7. Highlight the panel header and open the 'Other Controls' menu. Click on the [ControlBar] option to add a controlbar to the panelheader.

    images/hook7.png
  8. Highlight [Panel Card End: PANELCARD_1] and open the Containers menu again. Click on the [Container] option.

    images/hook8.png
  9. From the Container Type list select the 'Injectible Content' option and click 'Insert After'.

    images/hook9.png
  10. Highlight the Injectible Content container and open the 'Data Controls' menu. Click on the [List] option. Give the list the name 'listMenu' and click OK to add the list control to the injectible content container

    images/hook10.png
  11. The component tree should now look like this:

    images/hook11.png

The List Control

  1. Highlight the List control. Scroll down the properties list to the List Properties section. Set the 'Width' property to be 100%

    images/hook12.png
  2. Click the [...] button next to the 'List properties' property to open the List Builder.

    images/hook13.png
  3. In the List Builder's 'Data Source' pane select 'Static' from the 'Data Source Type' menu.

    images/hook14.png
  4. Click the [...] button next to the 'Static data' property.

    images/hook15.png
  5. Click the 'Sample data' link.

    images/hook16.png
  6. From the 'Sample Data' dialog click on the 'Sample menu system (uses Font-Awesome Icon Fonts) option and click OK.

    images/hook17.png
  7. In the 'Static Choices' dialog erase the text underneath the sample data and click OK.

    images/hook18.png
  8. Open the 'Fields' pane and highlight the 'Image' field.

    images/hook19.png
  9. In the properties list on the right set the 'Control type' property to be CSSIcon. This should be in the Client-side section.

    images/hook20.png
  10. Open the 'List Properties' pane. In the Layout Properties section set the Layout type to be 'Freeform'.

    images/hook21.png
  11. Scroll down to the 'Javascript - Run Time' section and click the [...] button next to the 'OnSelect' property.

    images/hook22.png
  12. In the 'List Control System Events' dialog set the OnSelect event to be the following and click OK.

    var cbObj = {dialog.object}.getControl('CONTROLBAR_1');
    cbObj.hideDisclosure();
    images/hook23.png
    When a row is tapped in the list this code will get the controlbar and then hide that control bar's disclosure. The controlbar is defined in the next section.
  13. Open the 'List Layout' pane. Add the following HTML to the template section and click OK to close the List Builder.

    <div style="display: table; width: 100%;">
    	<div style="display: table-cell;">
    		<div class="{dialog.style}ListItemLabelMain">{Image} {MenuName}</div>
    	</div>
    
    	<div style="display: table-cell; width: 40px; text-align: right; vertical-align: middle;">
    		<img src="{images.dialog.listNav}"/>
    	</div>
    </div>
    images/hook24.png
  14. On the UX Controls page highlight the [Injectible Content: INJECTIBLE_1] container.

    images/hook25.png
  15. In the Container Begin Properties section on the right find the 'Container style' property and add the following CSS:

    color: #000000; background-color: #ffffff;
    images/hook26.png
    If you don't apply a color and a background to the injectible container the list will be invisible unless it is hovered over.

The ControlBar control

  1. In the UX Controls page highlight the ControlBar control.

    images/hook27.png
  2. In the properties list click on the 'ControlBar properties' property to open the ControlBar Builder.

    images/hook28.png
  3. In the Disclosures pane click the 'Add Disclosure' button. Leave the name as 'Disclosure1' and click OK.

    images/hook29.png
  4. In the properties list click the [...] button next to the HTML property, under the 'Disclosure Properties' section

    images/hook30.png
  5. Click the 'Insert content from an 'Injectible Container' button.

    images/hook31.png
  6. Select the 'INJECTIBLE_1' option and Click OK.

    images/hook32.png
  7. Click OK again.

    images/hook33.png
  8. Click on the [...] button next to the onSize property in the Events section of the properties list.

    images/hook34.png
  9. Define the following Javascript for the onSize event and click OK:

    var lObj = {dialog.object}.getControl('listMenu');
    $(lObj.contId).style.height = ele.offsetHeight+'px';
    lObj.resize()
    images/hook35.png
    The onSize event fires when the disclosure is shown. This code resets the height of the list to the height of the disclosure. Here 'ele'' is a pointer to the div that contains the disclosure.
  10. Open the Items pane. Click the 'Add ControlBar Item' button.

    images/hook36.png
  11. From the 'Item Type' choices select the 'disclosure-button' option and click OK.

    images/hook37.png
  12. Click the [...] button next to the 'Disclosure name' property, in the properties list under Disclosure Settings section.

    images/hook38.png
  13. Select Disclosure1 and click OK.

    images/hook39.png
  14. Click the [...] button next to the 'Display type' property.

    images/hook40.png
  15. Select 'outside-before' and click OK.

    images/hook41.png
  16. In the Disclosure Settings section set the 'Size' property to be 200px.

    images/hook42.png
    This is the size of the disclosures width, due to the fact that the Display type has been set to be 'outside-before'.
  17. Scroll down the ControlBar Item Properties list to the 'Button Settings' section. From the dropdown next to the 'Button layout' property select 'Image only'.

    images/hook43.png
  18. Click the [...] button next to the 'Icon' property.

    images/hook44.png
  19. Choose the 'SVG Icon' option and hit 'Select'.

    images/hook45.png
  20. From the built-in icons select the 'bars' option and click OK and OK again.

    images/hook46.png
  21. Open the ControlBar Layout pane and click the Add Layout button.

    images/hook47.png
  22. Leave the layout name as 'Layout1' and click OK.

    images/hook48.png
  23. Click the 'Add Line' button.

    images/hook49.png
  24. In the Edit Layout Line dialog click the 'Add' button under the 'After' section. Select the Disclosurebutton1 and click OK, OK, and OK again to close the ControlBar Builder.

    images/hook50.png
  25. Run the component in Working Preview. Click on the 'bars' icon in the ControlBar

    images/hook51.png
  26. The list of static data that you defined in the list control should open.

    images/hook52.png
  27. Click on one of the rows in the list and the menu should close.

    images/hook53.png