my code stock.com

bansteatt84

Create a colored legend in a grid
by bansteatt84

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:

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

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,

See "Show a thematic legend in a grid"

Snippet options

Download: Download snippet as create-a-colored-legend-in-a-grid.txt.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

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

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

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.