Create a colored legend in the grid

Technologies > Software Engineering Techniques > Advanced Techniques > Generate a Colored Legend

This example shows how to create a colored legend as a separate column in a work request grid. The legend colors highlight the work request status. The panel definition includes a custom field for the legend column:

<field id="legend">
<title>Legend</title>
</field>


In the JavaScript, map the status values to different colors and set the background color for each legend cell using setStyle() :

var cell = row.cells.get('legend');
Ext.get(cell.dom).setStyle('background-color', color);


Some tables include a hpattern_acad field, which stores a highlight color pattern. For a demonstration of how this can be used to set the colors of a grid column legend,

View: http://localhost:8080/archibus/schema/ab-products/solutions/programming/grid/ab-ex-prg-grid-legend.axvw