Skip to Content
avatar image
Former Member

How to highlighted some of the rows of table to bold dynamically

Hi,

I am fetching data and displaying in table .My requirement is i have to make some of the rows bold based

on condition.I did like below.

1.I created model and bind that model into custom controller ,it created one input model node and one out put node.

2.I mapped model node from custom context to view context.

3.In view context I created model node already created during context mapping from custom context to view context.I created one Value attribute in view context made calculate true and type is TextViewDesign and read only property true.In table's Text view's design property I set to what value attribute i created .In view

implementation's setter method i wrote the following code.

public com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign getCalculateTest(IPrivateResultView.IContextElement element)

{

//@@begin getCalculateTest(IPrivateResultView.IContextElement)

int n = wdContext.nodeBirthdaylist().size();

for(int i=0;i<n;++i){

if(wdContext.nodeBirthdaylist().getBirthdaylistElementAt(i).getEmail_Id()!=null){

return (WDTextViewDesign.EMPHASIZED);

}

else{

return(WDTextViewDesign.EMPHASIZED);

}

//element.

}

//@@end

}

it is showing error that method should return WDTextViewDesign type.Is above code is correct.

Thanks & Regards

muna

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • avatar image
    Former Member
    Oct 30, 2006 at 12:24 PM

    Hi

    Try this

    public com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign getCalculateTest(IPrivateTestEVSView.IContextElement element)

    {

    // @@begin getCalculateTest(IPrivateResultView.IContextElement)

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign design=null;

    int n = wdContext.nodeBirthdaylist().size();

    for(int i=0;i<n;++i){

    if(wdContext.nodeBirthdaylist().getBirthdaylistElementAt(i).getEmail_Id()!=null){

    design=(WDTextViewDesign.EMPHASIZED);

    }else{

    design=(WDTextViewDesign.EMPHASIZED);

    }

    // element.

    }

    return design;

    // @@end

    }

    Kind Regards

    Mukesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 30, 2006 at 01:40 PM

    Hi Mukesh,

    Thanks a lot for your immediate reply.Now it is not showing error but i am giving condition if email id is not null font of text should be emphasized otherwise it should be label,i mistakely mentioning emphasize both for

    if and else part.I changed from emphasized to lable in else part but for all only emphasized color is comming.That means empahsized color of font is comming for all records even if mail id may or may not exist.So how i will fix it .

    Thanks & Regards

    muna

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Small correction:

      instead of <i>For this value attribute, calculate text view design based on currentElement value</i>

      use <i>For this value attribute, calculate text view design based on parameter <b>element</b> value</i>

      VS

  • avatar image
    Former Member
    Oct 31, 2006 at 10:34 AM

    Hi VS,

    Is it correct,I created one calculate value attribute

    under Birthdaylist node(This node is providing data)and I made the read only property to false.In setter and getter method I put the code lilk below.

    public void setBirthListCalculate(IPrivateResultView.IBirthListElement element, com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign value)

    {

    //@@begin setBirthListCalculate(IPrivateResultView.IBirthListElement, com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign)

    IBirthdaylistNode myValues =wdThis.wdGetBAL_EP_HR_BirthDayCustController().wdGetContext().nodeOutput().nodeBirthdaylist();

    com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign design=null;

    int n = myValues.size();

    for(int i=0;i<n;++i){

    //return (myValues.getBirthdaylistElementAt(i).getEmail_Id()!=null)? WDTextViewDesign.EMPHASIZED : WDTextViewDesign.EMPHASIZED;

    if(myValues.getBirthdaylistElementAt(i).getEmail_Id()!=null){

    element.setCalculate(value.EMPHASIZED);

    }

    else{

    element.setCalculate(value.LABEL);

    }

    }

    //@@end

    }

    public com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign getBirthListCalculate(IPrivateResultView.IBirthListElement element)

    {

    return element.getCalculate();

    }

    Is above code is correct but it is giving stack over flow exception.

    Thanks & Regards

    muna

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Muna,

      There are should be no setter at all (mark attribute as read-only). Put the following in getter:

      public com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign getBirthListCalculate(IPrivateResultView.IBirthListElement element)
      {
        IBirthdaylistNode myValues = 
          wdThis
            .wdGetBAL_EP_HR_BirthDayCustController()
              .wdGetContext()
                .nodeOutput()
                  .nodeBirthdaylist();
      
          int idx = element.index();
      
          if ( myValues.getBirthdaylistElementAt(idx).getEmail_Id()!=null )
            return value.EMPHASIZED;
      
          else
            return value.LABEL;
      
      }
      

      Valery Silaev

      SaM Solutions

      http://www.sam-solutions.net

      Message was edited by: Valery Silaev

  • avatar image
    Former Member
    Oct 31, 2006 at 12:06 PM

    Hi VS,

    value variable is not declared .Can you tell me which type value variable is.

    Thanks & Regards

    muna

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 31, 2006 at 01:29 PM

    Hi VS,

    My code is

    public com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign getBirthListCalculate(IPrivateResultView.IBirthListElement element)

    {

    //@@begin getBirthListCalculate(IPrivateResultView.IBirthListElement)

    IBirthdaylistNode myValues =wdThis.wdGetBAL_EP_HR_BirthDayCustController().wdGetContext().nodeOutput().nodeBirthdaylist();

    int idx = element.index();

    if(myValues.getBirthdaylistElementAt(idx).getEmail_Id()!=null){

    return WDTextViewDesign.EMPHASIZED;

    }

    else{

    return WDTextViewDesign.LABEL;

    }

    //@@end

    }

    It is making all the records EMPHASIZED,It is not working based on the condition that if email id is not null record should be emphasized otherwise it should be lable.

    Thanks & Regards

    muna

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Where in the context did you add the attribute "BirthListCalculate"? You have to add it (and perhaps name it more properly) under the data source node of the table, not under the context root node.

      Assuming the following view controller context structure

      - Birthdaylist (model node, mapped to custom controller)
        - Email_Id (attribute)

      change it to:

      - Birthdaylist (model node, ...)
        - Email_Id (attribute)
        - Decoration (value node, cardinality 1:1, selection 1:1, singleton=false)
          - TextDesign (attribute, DDIC type TextViewDesign, calculated=true, readOnly=true)
      

      Implement the getter like

      WDTextViewDesign getDecorationTextDesign(IDecorationElement element)
      {
        IBirthdaylistElement birthday = (IBirthdaylistElement)element.node().getParentElement();
        return birthday.getEmail_Id() != null
          ? WDTextViewDesign.EMPHASIZED
          : WDTextViewDesign.LABEL;
      }

      Armin

  • avatar image
    Former Member
    Nov 01, 2006 at 05:03 AM

    Hi LM,

    Thanks for your suggestion ,I tried your solution but i am facing same problem.

    Thanks & Regards

    muna

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi

      Create an attribute with type com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign

      in the Table node and bind it to that textview's design property and set the value according to your conditions.

      if(myValues.getBirthdaylistElementAt(idx).getEmail_Id()!=null && !myValues.getBirthdaylistElementAt(idx).getEmail_Id().equals(""){

      wdContext.currentBirthdaylistElement().set<Param>(WDTextViewDesign.EMPHASIZED);

      }

      Kind Regards

      Mukesh

  • avatar image
    Former Member
    Nov 01, 2006 at 08:53 AM

    Hi mukesh,

    I created one value attribute in ResultView(Table view) Context and when i am trying select value for type property from Dictionary Simple type ,com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewDesign option is not comming.

    Thanks & Regards

    muna

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi

      You can select it from type com.sap.ide.webdynpro.uielementdefinitions.TextViewDesign

      Kind Regards

      Mukesh

  • avatar image
    Former Member
    Nov 01, 2006 at 09:38 AM

    Hi mukesh,

    I already did that and what ever the code i send ,i wrote in getter method.

    Thanks & Regards

    muna

    Add comment
    10|10000 characters needed characters exceeded