cancel
Showing results for 
Search instead for 
Did you mean: 

Display table cell color based on condition

Former Member
0 Kudos

Hi experts,

i have one requirement let me explain

I have one table (Table1) in that i have the columns duedate ans status and some other columns

bind ui elements to the bapi fields

now my question is

if(sysdate<=duedate)

{

display cell in green color ;

}

else

if(sysdate<=duedate+7 days)

{

display cell in orange color ;

}

else

if(sysdate>=duedate+7 days)

{

display cell in red color ;

}

I am not able to do this please help me through the required steps to be done to achieve this

if possible try to send the related document on this.

Its very urgent

Thanks in advance,

Fayaz Shaik

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hello Fayaz,

  Create one attribute called "cell editor" with type simple Type TableCellDesign (com.sap.ide.webdynpro.uielementdefinitions.TableCellDesign) and bind to the Table Column Properties ---->CellDesign

and write the code like below

if(sysdate<=duedate)

{

//display cell in green color ;

wdContext.currentContextElement().setCelleditor(WDTableCellDesign.goodvalue_dark);

}

else

if(sysdate<=duedate+7 days)

{

//display cell in orange color ;

wdContext.currentContextElement().setCelleditor(WDTableCellDesign.

criticalvalue_dark)

);

}

else

if(sysdate>=duedate+7 days)

{

//display cell in red color ;

wdContext.currentContextElement().setCelleditor(WDTableCellDesign.badvalue_dark);

}

Note: in the init method you can call it as s standard color:

wdContext.currentContextElement().setCelleditor(WDTableCellDesign.STANDARD);

Hope it will helps

Regards,

Manivannan P

anja_engelhardt2
Active Contributor
0 Kudos

moved to Web Dynpro Java by moderator

junwu
Active Contributor
0 Kudos

this one may be better

http://scn.sap.com/docs/DOC-2563

junwu
Active Contributor
0 Kudos
former_member221367
Participant
0 Kudos

Is it in smartform or any other context?