Wijmo provides a WjFlexGridCellTemplate directive for Angular that allows you to define a template for any type of FlexGrid cell.
This example shows a FlexGrid that includes all of the cell types available, and allows you to selectively apply specific cell templates to the control. Each template applies to every cell of its specified type within the control. Clear a checkbox to see the template removed from all instances of that cell type.
Note that in order to see the change for the CellEdit cell type, you must first double-click inside a cell to put it in edit mode. To see the change for the RowHeaderEdit cell type, put any cell into edit mode, and look at the RowHeader cell for that row.
This sample demonstrates cell templates with conditional content controlled by the Angular ng-if directive. It is based on the same CollectionView data source as the previous example, grouped on the Country column, but this one appears like a summary report. It shows only group rows with a white background. (The background color is set in the CSS tab.) There are no visible detail rows in this grid.
The first Country column shows GroupHeader cells that are customized to show country flags. The Downloads
column shows Group cells with a nested FlexGrid or FlexChart control bound to the group’s child
items (items-source="$item.items"). This allows us to show statistical data for the group,
either as a chart or as a table. The customized Downloads column’s template adds a ComboBox that allows the user
to choose how to represent the data.
The ng-if attribute on the FlexGrid and FlexChart directives is bound to the value selected in the ComboBox, and controls which one appears in the group cell.
This example is a variation of the previous example, but the inclusion and settings of statistical data columns in this grid is defined as an array in the controller. The wj-flex-grid-column directive is bound to this array via the Angular ng-repeat directive. Each column settings object includes columnHeaderTemplateUrl and groupTemplateUrl properties containing paths to html files with cell template content for the cells.
This content is included in the wj-flex-grid-cell-template directives using the Angular ng-include directive.
Each column settings object also has an isAvailable property indicating whether the column is included in the FlexGrid. The inclusion is controlled by the ng-if attribute on the wj-flex-grid-column directive. You can change this value for each column settings object using the Wijmo ListBox control with checkboxes, which is bound to the column settings array.
The Country column is defined statically in the markup, and retrieves its GroupHeader cell template’s content from the countryGroupHeaderTemplate.html file.