Hi all,

I tried to set the background color of grid item using the following commands. But nothing worked:

1.    api_component.setbackgroundcolor(panelname.itemname, color);
eg.   api_component.setbackgroundcolor('INV_GRID_PANEL.CUSTOMER_ID', 'green');

I am not getting any error. But color does not appear.

2.    api_component.setbackgroundcolor(panelname.gridname.itemname, color);
eg.   api_component.setbackgroundcolor('INV_GRID_PANEL.GRID.CUSTOMER_ID', 'green');

I get the message Specified component name 'INV_GRID_PANEL.GRID.CUSTOMER_ID' not found.

I have no problem with grid header background color.

Please help.

Regards.

George.

asked 30 Mar '14, 16:08

grajan777's gravatar image

grajan777
1011234
accept rate: 10%

edited 30 Mar '14, 16:10


Hi George,

I guess a backgroundColorColumn is set for this grid item. If so, you have to set its background color through the datasource column which is bound to the backgroundColorColumn. As an example, if your item declaration is like:

    <grid dataSource="yourDS">
      <column>
        <textField name="CUSTOMER_ID" column="CUSTOMER_ID" backgroundColorColumn="bg_column"/>
      </column>
    </grid>

You can change the background color using the following API call:

api_datasource.setColumnValue('yourDS.bg_column', 'green', api_datasource.ALL_ROWS);

If it does not help, please post your grid XML.

Regards,
Ibrahim

link

answered 31 Mar '14, 02:50

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

Hi Ibrahim,

I was able to do it after creating a dummy database column through a view. Having to modify the database for adding color does not seem to be the best design for numerous reasons. If every front end tool is going to have a similar constraint for development the database will become a mess after some time. Further, it requires modifying hundreds of tables or views.

We need to set different background colors for disabled items, LOVs, Cost/Profit columns when the values are too high or low, Item column to indicate the type of item and there are very many requirements. While the system is being used, the users will further give additional requirements for background color. We were able to do it in Oracle forms simply without any backend modification.

I am not complaining or anything. I am just trying to bring to your kind notice some of the problems with this kind of design.

Though I very much want to apply background colors, unfortunately I cannot use it this way. This will definitely create a negative impact when the product being developed is taken to a demo because ours is not the only product any company is considering to purchase.

With regards,

George.

(31 Mar '14, 05:49) grajan777

Hi George,

It's not mandatory to define a dummy database column in order to change the background color. If a backgroundColorColumn is not defined, you should be able to change the backgroundColorColumn using api_component.setbackgroundcolor API. Can you copy your grid definition?

Regards,
Ibrahim

(31 Mar '14, 06:16) Ibrahim Sand... ♦♦

Hi Ibrahim,

Thank you for your help. I am copying my grid definition as below. My panel name is INV_GRID_PANEL. The API command I used are present in my initial question. The command does not give any error nor does it show the color. Please help:

    <grid name="GRID" dataSource="OTV_SO_M"  rowHeight="17">
      <column headerLabel="CUSTOMER ID" >
        <textField name="CUSTOMER_ID" column="CUSTOMER_ID"/> 
      </column>
    </grid>

with regards.

George

(31 Mar '14, 07:14) grajan777

Hi George,

I tried the API with the XML that you have provided but I cannot replicate the problem, it seems working fine for me. If you use default CSS, please note that the current row's background color is always yellow regardless the component's background color.

Regards,
Ibrahim

(03 Apr '14, 02:28) Ibrahim Sand... ♦♦

Hi Ibrahim,

So what is the solution? The default CSS should not be used?

Yes, this is actually the issue. I think the background color should be applied regardless of the current row color. This is the behavior of many other system I worked. I can send you samples screens, if required.

But how it is working with "bg_column" method even if the default CSS is used?

George.

(03 Apr '14, 03:13) grajan777
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×14
×2

Asked: 30 Mar '14, 16:08

Seen: 1,082 times

Last updated: 03 Apr '14, 03:13


© Copyright Gerger 2017