Creating an HGrid

Note: This procedure assumes inline data (as shown in the example at the end of this topic) has been inserted in the UIX file. The inline data named "treeData" produces the object hierarchy column starting with the root 'Primary Colors'. It also provides the data for the column stamp, which generates three columns of color codes. The inline data named "demoTableData" provides the data for columnHeaderStamp.

To create an hGrid component:

  1. In the Design Structure Window of the desired file, locate the node in which you wish to insert an hGrid component.
  2. In the Component Palette, select Table Components from the dropdown list, and then drag and drop the hGrid component to the parent node of your choice.

    The hGrid node is inserted and highlighted under the expanded parent node. By default 'No items are found' is displayed in the empty hGrid in the UIX Visual Editor.

  3. In the Property Inspector, set the following attributes for the hGrid component:
  4. If you specified the treeData attribute, the contents of the object hierarchy column are automatically defined for you. Otherwise, do the following to define a stamp for customizing the object hierarchy column using the nodeStamp named child. You can also use these steps to change the default header for the object hierarchy column:
    1. In the Design Structure Window, expand the hGrid node to locate the nodeStamp named child node. Right-click nodeStamp and choose Insert inside nodeStamp | column .

      The column node is inserted and highlighted under the expanded nodeStamp node.

    2. Expand the new column node to locate the columnHeader named child. Then right-click columnHeader and choose Insert inside columnHeader | styledText.

      The styledText node is inserted and highlighted under the expanded parent node.

    3. In the Property Inspector, change the text attribute of styledText to a value of your choice, e.g., Color. Otherwise, 'Name' is the default header for the object hierarchy column.
    4. To customize the object hierarchy column contents, right-click the column node created in step 4a to insert the desired component. Using our example, we would choose Insert inside column | styledText, and then in the Property Inspector, we would change the text attribute of styledText to the value of ${uix.current.text}.
  5. To add other columns as indexed children of hGrid, do the following:
    1. In the Design Structure Window, right-click the hGrid node and choose Insert inside | hGrid | column.
    2. Repeat step 5a to add the desired number of columns. In our example, we need to add two other columns.
    3. To define a column header stamp, locate the columnHeaderStamp named child node under the hGrid node. Then right-click columnHeaderStamp to insert the desired component. In our example, we would choose Insert inside columnHeaderStamp | styledText, and then in the Property Inspector, we would change the text attribute of styledText to ${uix.current.textKey}.
    4. To define a column stamp, for each column you created in steps 5a and 5b, right-click the column node to insert the desired component. Using our example again, we would choose Insert inside | column | styledText , and then in the Property Inspector, we would change the text attribute to ${uix.current.r}, ${uix.current.g}, ${uix.current.g}, respectively, for the three columns.
  6. To add singleSelection or multipleSelection to the hGrid, see Using SingleSelection or MultipleSelection (TableSelection).
  7. To add components for performing actions on the hGrid that are independent of row selection, see Using TableActions.
  8. To make the hGrid interactive and set the initial focus, see About HGridProxy.

Tip: Use the 'nameTransformed' attribute of the column component to specify whether any name transformation should occur when rendering data form controls.

Note: To use data binding, see Data Binding a Component Attribute.

Example (UIX XML)


...
<provider>
  <data name="treeData">
    <inline>
      <nodes text="Primary Colors" expandable="expanded">
        <nodes text="Red" r="Any" g="00" b="00"/> 
        <nodes text="Green" r="00" g="Any" b="00" expandable="expanded">
          <nodes text="Light" r="00" g="FF" b="00"/> 
          <nodes text="Dark" r="00" g="88" b="00"/> 
        </nodes>
        <nodes text="Blue" r="00" g="00" b="Any"/> 
      </nodes>
    </inline>
  </data>
  <data name="demoTableData">
    <inline>
      <demoColHeaderData textKey="Red Code"/>
      <demoColHeaderData textKey="Green Code"/>
      <demoColHeaderData textKey="Blue Code"/>
    </inline>
  </data>  
</provider>
...
<contents>
...
  <hGrid alternateText="No items were found" 
         columnHeaderData="${uix.data.demoTableData.demoColHeaderData}" 
         proxy="${uix.eventResult.hGridProxy}" 
         treeData="${uix.data.treeData2.nodes}">
    <!-- nodeStamp named child customizes header of object column -->
    <nodeStamp>
      <column>
        <columnHeader>
          <styledText text="Color"/>
        </columnHeader>
      </column>
    </nodeStamp>

    <!-- indexed children define contents of other columns -->
    <contents>
      <column>
        <contents>
          <styledText text="${uix.current.r}"/>
        </contents>
      </column>
      <column>
        <contents>
          <styledText text="${uix.current.g}"/>
        </contents>
      </column>
      <column>
        <contents>
          <styledText text="${uix.current.b}"/>
        </contents>
      </column>
    </contents>

    <!-- columnHeaderStamp stamps out headers for other columns -->
    <columnHeaderStamp>
      <styledText text="${uix.current.textKey}"/>
    </columnHeaderStamp>
  </hGrid>
  ...
</contents>
...    

About HGrid and its Named Children

Working with Table Components

 

Copyright © 1997, 2004, Oracle. All rights reserved.