UNPKG

pragma-views2

Version:

42 lines (31 loc) 1.76 kB
# Pragma - Grid This document describes the required features for the pragma-grid component. ## Component This must be a standard web component that extends HierarchicalBase. The component must be able to show grouped and leaf items. Group items take up the full length of the control across all the columns. Leaf nodes are rendered per column. ## Usage The component is used in the HTML markup. The following is a example of how it is used. ```html <pragma-grid> <pragma-grid-column field="code" title="Code" background-color="red" width="100px" /> <pragma-grid-column field="description" title="Description" width="fill"/> </pragma-grid> ``` You will see that the grid settings are added as child elements of the grid. These are also custom elements but they have a empty template. There are a number of properties, some of the required, some of them not required. The required properties are: 1. field - what is the property name on the model where you will get the value. this can be a path. 1. title - what is the heading for the column in the th. Optional properties are: 1. width: how wide do you want the column to be. fill means take up the remaining space. 1. background-color: what color should the background be. 1. color: what should the text color be. ## Features In the future we will extend the features to include column grouping and sorting but for now all we want is for the user to be able to select a record. When a record is selected the selected id must be set to the selected record. Because you can not assume that the primary key is ID you need to define on the schema what field on the model represents the id. When making a selection the selected Id is set to that field.