Skip to Main Content
Feature Request FR-2656
Product Area Page Components
Status CLOSED

3 Voters

interactive grid cell background color base on another field

tdoberman Public
· Jul 27 2022

Idea Summary
There is an option to color the target with a selected color based on any condition. However, the option to set the color based on another field in the database is missing!

Use Case
Option very useful when colors are determined dynamically by the query / database.

Preferred Solution (Optional)
Instead of selecting a color from the palette / typing the color value in HEX, it should be possible to type/select a color column

This is a great idea! You can already achieve this in APEX today with a slightly different approach.

Comments

Comments

  • shelly.simpson OP 1.8 years ago

    We’ve had to write a lot of custom code to get something like this to work and it would be much easier/cleaner to have it built-in.

  • john.snyders APEX Team OP 1.8 years ago

    The feature already exists to use a column to specify the css class for a cell. This is more flexible than just setting the background color because you can do many more style customization with a CSS class. 

    The feature is not declarative but an option (cellCssClassesColumn) of the grid widget column config. This idea could be realized by making the cellCssClassesColumn declarative.

    See IG Cookbook page 36. Here is the column code:

    function(options) {
        options.defaultGridColumnOptions = {
            cellCssClassesColumn: "CELL_CLASS"
        }
        return options;
    }
    

    Where CELL_CLASS is the name of a column from the SQL query that has a class name to control the background color or other styles.

  • tdoberman OP 1.8 years ago

    Sounds delectable, I'll check it out tomorrow.... AND if it works.... it's actually hidden, it would be good if the column simply had a class where you can enter the field name - not through javascript - because it's not obvious!

  • jochen.zehe OP 6 weeks ago

    The feature is not declarative but an option.

    It would be great if this would be declarative. Actually I just found out this works for the background colors. So far I was using this popular JS snippet for IR and IG:

    apex.jQuery("span[data-style]").each(
     function(){ apex.jQuery(this).parent().attr( 'style', apex.jQuery(this).attr('data-style') ); 
     });
    

    https://mk-commi.blogspot.com/2016/01/coloring-cells-in-interactive-report.html

  • jochen.zehe OP 6 weeks ago