Changing List Displays

From IHRIS Wiki
Revision as of 10:30, 15 November 2011 by Litlfred (talk | contribs) (Created page with "There are many lists in the system and there are many options on how to display them. ==Example: Position List== ===The Default Display=== The default position list display is...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

There are many lists in the system and there are many options on how to display them.

Example: Position List

The Default Display

The default position list display is set in the configuration .xml file for the ihris-manage-PersonPosition module. You can see where this is defined in magic data on lines 795-811. Here we are defining the "default" list display at the magic data node:

/modules/forms/formClasses/iHRIS_Position/meta/list/default

The three important parts here are:

  • The "display_string" which is "%s: %s (%s, %s)". Whenever you see a '%s' you in the display string we expect to substitute a field of the form into the string. For more details, see the explanation of the printf format.
  • The "display_args" which are the fields that are passed to the display string. These are substituted in order into the display string.
    • 0:code
    • 1:title
    • 2:facility
    • 3:department
  • The order in which the list is displayed. We are specifying that we first sort by the position code. Then, if two positions have the same code for some reason (or no code at all), then we sort by the title
    • 0:code
    • 1:title

Changing the Default Display

Suppose that you wanted to customized the position list so that it no longer displays the position code. We could do so with the following: <source lang='xml'>

         <configurationGroup name="meta" path="meta/list/default">
           <configuration name="display_string">
             <value>%s (%s, %s)</value>
           </configuration>
           <configuration name="display_args" type="delimited" values="many">
             <value>0:title</value>
             <value>1:facility</value>
             <value>2:department</value>
           </configuration>
           <configuration name="sort_fields" type="delimited" values="many">
             <value>0:title</value>
             <value>0:facility</value>
             <value>1:department</value>
           </configuration>
         </configurationGroup>

</source>