Filtering Table Rows
Table rows can be filtered based on the result of an expression.
When rows are filtered out, they are removed from the table dataset before the table is rendered, and so won't trigger any custom renderers, and won't be included in any table or column level user filtering.
To filter rows, you provide an expression to the
row-filter attribute of a
<vdl-table> element. This can be a simple Boolean expression, an inline function or a function identifier. In all cases, the following arguments are provided:
- rowData: data for all the row cells.
- indices: data for the index columns of the row.
- position: row position in the table.
- tableData: data for all table rows and contained cells.
When an inline function or a function identifier is specified, they should return a Boolean result, with true signifying that a row should be kept, and false signifying that a row should be discarded. The function is called for each row in the table before it is rendered to the view.
In the following example, the
Shares_fraction array component is displayed having discarded rows where the calculated investment equals zero.
<vdl version="4.7"> <vdl-page> <vdl-section> <vdl-row> <vdl-column> <vdl-table row-filter="=rowData[1] > 0.0"> <vdl-table-column entity="Shares_fraction" heading="Allocation of investment" size="3"></vdl-table-column> </vdl-table> </vdl-column> </vdl-row> </vdl-section> </vdl-page> </vdl>

Rendered Results of Row Filtering