cancel
Showing results for 
Search instead for 
Did you mean: 

Changing Color of single Table Cells

Former Member
0 Kudos

Hi,

I have a question on how to handle the Color of single cells in a Table of a WebDynpro application.

In my project I created a View in which I want to show data of an underlying RFC Model via table.

The values of some columns contain negativ values, wich are marked and delivered by a '-' by the SAP System. These values I want to mark with the column property Semantic Color.

I tried to handle this by defining a value attribute 'negative' in the context of my view and pointed the Semantic Color property to this value.

For every line of the table I check on '-' and if found t the 'negative' Attribute is set to 'CRITICAL'.

Now when I start the Application the value is set for the whole column. Is there a posibility to change the Semantic Color property only for special cells of a table column or is there another posibility to solve this problem?

Best Regards,

Robert

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Let "Rows" be the context node used as the the table's data source.

Add a subnode "State", cardinality 1:1, selection 1:1, singleton=false to "Rows".

Add a calculated attribute "TextColor" of type "TextViewSemanticColor" to "State".

In the generated get-method of the calculated attribute, return WDTextViewSemanticColor.NEGATIVE if the corresponding "Rows"-element has a negative value.

Bind the "semanticColor" property of the TextView (table cell editor of column showing values) to attribute "Rows.State.TextColor".

Armin

Former Member
0 Kudos

Thanks for this solution,

I`ve tried it and it works. One problem is, that I have many columns to check for negative values. So I took one Attribute for every column.That means many lines of code for the get-methods of 20 or more columns. It`s ok but maybe there is another way to handle this more efficiently.

Regards,

Robert

Former Member
0 Kudos

The only way (I see at the moment) would be to build a reusable Web Dynpro component that provides this functionality by default (or could be configured to provide it).

But the effort to create such a component has to be taken into account.

The ALV component (already existing for WD ABAP, but not for NW04 WD Java) probably has this functionality?

Armin

Answers (1)

Answers (1)

Former Member
0 Kudos

JavaScript?

ag