Saturday, February 23, 2019

Oracle JET Table with Template Slots for Custom Cells

Oracle JET table comes with template slot option. This is helpful to build generic functionality to render custom cell within the table.

In this example, custom cells are used to render dates, amount and risk gauge:


While implementing Oracle JET table it is a best practice to read table column structure from a variable, not to define the entire structure in HTML itself. Property columns refer to the variable. Template called cellTemplate is a default template to render cell content:


Table column structure is defined in JS. To apply specific cell template, it is specified in column definition:


Table data is static in this example and coming through JSON array based on JET Array Data Provider:


Sample code is available on GitHub.

No comments: