Initializing help system before first use

Working with Tables

The Table or <vdl-table> component is powerful mechanism that generates tables from a given list of array entities from one or more scenarios.

A Table element inspects the properties of each array entity, discovering their index sets. If all of the index sets match (same type, same length), then a table is generated. However, you can filter individual index sets per entry if you need to include arrays that contain additional indices. It should contain one Table Column or <vdl-table-column> element for each column you wish the table to include.

We can use a table to display columns based on the Shares_fraction and Shares_Return entities:

View Designer

Code editor
<vdl version="4.7">
    <vdl-page>
        <vdl-section heading="Welcome to Portfolio Optimization" heading-level="1">

            <vdl-row>
                <vdl-column heading="Recommended share allocations" heading-level="3">
                    <vdl-table page-mode="paged" page-size="5" column-filter="true" show-filter="true">
                        <vdl-table-column entity="Shares_fraction"></vdl-table-column>
                        <vdl-table-column entity="Shares_Return"></vdl-table-column>
                    </vdl-table>
                </vdl-column>
            </vdl-row>
        </vdl-section>
    </vdl-page>
</vdl>
This renders as:

Rendering a two-column Table

A row has been created for each element of the SHARES index set, which indexes both frac and RET.

You can change the column titles by specifying a custom title, either by:
  • selecting the column in the View Designer and editing the Heading attribute.
  • adding a heading text value to the <vdl-table-column> node
<vdl-table-column entity="Shares_fraction" heading="The Shares Fraction Column"></vdl-table-column>.

Otherwise, the columns take their titles from model aliases or, if there are none, the model entity names. To customize any auto-generated index columns, you must provide a set attribute corresponding to the name of the index column to customize—as before, the custom title is provided as the text content of the <vdl-table-column> node.

This table contains two entities, if the index sets of all entities in the table are the same you can add as many as you wish.