cancel
Showing results for 
Search instead for 
Did you mean: 

displaying color for a particular column item in a table

Former Member
0 Kudos

hi Gurus,

I have an application which retrieved some data from back end R/3 system.

Now I am displaying the data in a table, now I have one column which displays the delivery date and in that we also have text displayed as "Cancelled".

Now I want to change the color of text "cancelled" whenever it is retrieved from the back end.

Thanks,

kris

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

closing

Former Member
0 Kudos

Which table cell editor is used in that column?

Armin

Former Member
0 Kudos

hi Armin,

Thanks for ur fast response.

I am using TextView table cell editor.

I am trying to implement this functionality to a value which is in the Model node, and I have to check a condition before applying this color change to the table cell editor.

If the value coming from the back end is "CANCELLED" then only I have to display it in color RED, and the remaining text should be displayed as normal text in black.

please suggest me how should I go further.

thanks and regards,

kris

Former Member
0 Kudos

Let "Rows" be the table data source node (model node).

Add a value node "State" to node "Rows".

Set State.cardinality = 1:1, State.selection=1:1.

Add a <b>calculated attribute</b> "Color" to "State", type=com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor,

readOnly=true, calculated=true.

Bind the "semanticColor" property of the TextView to attribute "Color".

Implement the generated get-method for the calculated attribute:


WDTextViewSemanticColor getColor(IStateElement element)
{
  IRowsElement row = (IRowsElement) element.node().getParentElement();
  return "CANCELLED".equals(row.getValue())
    ? WDTextViewSemanticColor.NEGATIVE
    : WDTextViewSemanticColor.STANDARD;
}

Armin

Former Member
0 Kudos

Hi Armin,

Here I have problem to mapping the Model attribute and "Textcolor" attribute in the newly created modelNode. That is not accepting in the Model node .

Please to suggest me .

Thanks

Gopi

Former Member
0 Kudos

In my example, "Rows" is the model node in the view controller context mapped to the model node in the component context.

You have to add a value node under this model node and add the attribute under the value node.

Or what was the question?

Armin

Former Member
0 Kudos

Hi Armin,

My question is I want get the value from the BAPI. and based on that value(CANCELLED).If Iam getting the value Cancelled then display as RED color Value and otherwise normal black.

Here I have created Model node and cardinality 1.1 and what u said all in the above .But After creating model node I am mapping BAPI Value attribute from the BAPImodel.After creating the color attribute"TextColor" .That Color Value node is not added to that Model Node.

If showing message like this "not possible to add the valuenode it was already mapped with model node".

How add the color Value node to the Already mapped valuenode from the BAPIModel.

Or otherwise is there any alternative for please help me out.

Advance Thanks.

Krishna.

Former Member
0 Kudos

Add the value node to the model node in the component controller (or wherever its origin is), map it from the view controller.

Armin