Edit the Form Grid to Display Different Fields Than the Subform

To customize the grid view to show different fields than the subform, follow these two main steps:

  1. Create a second view and view definition for the table.
  2. Point the original table grid view definition to the newly created table view definition.

In this example, we will use Preparation, but the steps apply to all tables with grid views.

Steps to Customize the Grid View

  1. Navigate to the Form Definition
    Access the form definition you want to edit using App Resources or the form meta menu to go directly to the current view definition.

  2. Select the Table for the Alternate View
    Go to the table you wish to create an alternate grid/table view for.

  3. Create a New View Definition
    Click on Create and select the definition you wish to use as the basis for the alternate table view.

  4. Name Your New View Definition
    Give the new view definition a recognizable name:

    Optionally, you can also assign a description:

  5. Modify the Duplicated Form’s View Definition
    Remove any fields you do not want to see in the grid view on the data entry forms. You can also change their order of appearance here.

  6. Switch to XML Mode
    Change the editor to XML mode by clicking on “Visual editor” and selecting “XML editor.”

  7. Locate Your View Definition in XML
    Find the name of your view definition in the <views> section of the XML. Press Ctrl + F (or + F on a Mac) and search for the view name you used (e.g., PreparationTable).

    You will see that the system view names for your modified view definition are Preparation (2) and Preparation Table (2). Copy the viewdef= next to the regular {Table Name} View (not the {Table Name} Table View). In this case, you need to copy:

    Preparation (2)
    
  8. Update the Original View Definition
    Find the <viewdef> in your form definition that has the attribute name="{Table Name} Table" (for example, name="Preparation Table").

  9. Replace the Definition
    Replace the <definition>{Table Name}</definition> component of this viewdef with the viewdef name you copied in the previous step:

    Original:

    <viewdef type="formtable" name="Preparation Table" class="edu.ku.brc.specify.datamodel.Preparation" gettable="edu.ku.brc.af.ui.forms.DataGetterForObj" settable="edu.ku.brc.af.ui.forms.DataSetterForObj">
        <desc>Preparation subform table for Collection Object form.</desc>
        <definition>Preparation</definition>
    </viewdef>
    

    Modified:

    <viewdef type="formtable" name="Preparation Table" class="edu.ku.brc.specify.datamodel.Preparation" gettable="edu.ku.brc.af.ui.forms.DataGetterForObj" settable="edu.ku.brc.af.ui.forms.DataSetterForObj">
        <desc>Preparation subform table for Collection Object form.</desc>
        <definition>Preparation (2)</definition>
    </viewdef>
    
  10. Save Your Changes
    Save your changes. The custom view definition (e.g., PreparationTable) should now define the columns in the grid/table view, while the original view definition will be used when the table is expanded.

    These definitions can be modified at any time from the visual editor!

    Regular View Definition:

    Custom Table/Grid View Definition:

    Screen Recording:


Instructions for Specify 6

Specify 6 Instructions

To get the form grid to display different fields than the subform:

There are two steps to editing the grid view to look different than the subview;
a) create a second view and viewdef for the table
b) point the original table grid viewdef to the newly created table viewdef.

For this example, I will use Preparation, but the steps will be the same for all tables with grid views.

  1. Copy the View for Preparation and paste it in the xml.

  2. Rename the second Preparation view to give it a unique name. Assign that name wherever you see ‘preparation’ in the view.

  1. Do the same for the Preparation Viewdef, changing the name in both the formtable and form viewdef.

  1. Modify the duplicated form’s viewdef to take out whichever fields you do not want to see in the grid view on the data entry forms. You can also change the order of appearance here.

  2. Once the form has the fields you want to see and has removed the fields you do not want to see, change the formtable’s definition to the duplicated viewdef’s name.

  1. Save the changes.
1 Like