cancel
Showing results for 
Search instead for 
Did you mean: 

Table data in red color

Former Member
0 Kudos

Hi All,

I have a requirement that based on date few records of a table should displayed in red and others should be in normal color.

Please help me out how to achieve this.

Thanks

Supriya.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you want to change the color of table row follow this

http://wiki.sdn.sap.com/wiki/display/Snippets/CreatingaColorLegendinaTableinWeb+Dynpro

In order to change the color of table content, use the textView ui element in table and set the design property.

Vinod V.

Former Member
0 Kudos

Hi Vinod,

Thanks for the reply. I used the semantic color property of text view for red color. But can u let me know how to access the each text view element at run time of the table to change it's property dynamically.

Thanks

Supriya.

Former Member
0 Kudos

Its a bindable property to TextView UI element. Create an attribute of type TextViewSemanticColor and bind it to the Semantic Color property. set its value while populate data to context.

Eg WDTextViewSemanticColor.POSITIVE

Vinod V.

Former Member
0 Kudos

Hi Vinod,

I did in that way. By doing that way all the records will take the same color. My requirement depending on a condition few records should come in red color and others in normal manner.

For this ar runtime i should set the text view's property of each table column to red or normal depending on the condition check. How to catch hold of the text view at run time is my question.

Thanks

Supriya.

Former Member
0 Kudos

I have verified it. its working fine for me.

code sample.


String names[] = { "a", "b", "c", "d"};
	  
	  IPrivateTestAplCompView.ITestElement element;
	  IPrivateTestAplCompView.ITestNode test = wdContext.nodeTest();
	  
	  int i = 0;
	  for( String name : names){
		  element = test.createAndAddTestElement();
		  	/** you may set condition here*/
		  	element.setDesignClr( WDTextViewSemanticColor.valueOf( ++i));
		  	element.setName( name);
		  	element.setDetails( "other details");
	  }

Ensure that you have binded the property with context attribute DesignClr

Vinod V.

Former Member
0 Kudos

Hi Supriya,

It is possible to read all element of the table node at run time. For this you have to read node element and based on your logic you can set particular line items/elements text viewu2019s color.

You can read element by below code:-

Based on the size of node you can run a for loop

for(int i=0;i<wdContext.nodeVn_Node().size();i++)

* wdContext.nodeVn_Node().getElementAt(0).getAttributeValue("Name");*

at this point you to have placed your logic and you can set color for particular row based on the previous reply by others.

Hope this may help you.

Deepak!!!

Former Member
0 Kudos

Hi Deepak,

This question is not accessing the node, but acessing the UI elemnt as we should set the property of text view and that cannot be done through accessing a node.

Thanks

Supriya.

Former Member
0 Kudos

Hi Supriya,

You can access UI element like blow code:-

IWDTextView txtView = (IWDTextView)view.getElement(String name); name will be ID of UI.

/* view used be of type com.sap.tc.webdynpro.progmodel.api.IWDView view*/

txtView.bindSemanticColor(String name); name will be color code

Hope this may help you.

Deepak!!!

Edited by: Deepak Arora on May 5, 2010 10:10 AM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Supriya,

Well you also few more options to look into, which might give you more idea:

[TechEd 2007: CD254 - Developing State-of-the-Art Table UIs in Web Dynpro Java - SAP NetWeaver 7.0|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/7436] [original link is broken] [original link is broken] [original link is broken];

[Colourful Table in Web Dynpro|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3548] [original link is broken] [original link is broken] [original link is broken];

Table Popin is too one good option for your requirement.

Hope it helps!

Thanks,

MS

Former Member
0 Kudos

Hi Supriya,

This situation can be handled in the following way by using Textview as table cell editor, use the property of Textview called Semanticolor option to display the output in different color.

wdContext.currentContextElement().setAttributeValue(WDTextViewSemanticColor.CRITICAL);

the above option for "RED" color, there are few more color option. please go ahead.

Thanks

Sathya