on 10-30-2006 11:31 AM
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
Hi mukesh,
I already did that and what ever the code i send ,i wrote in getter method.
Thanks & Regards
muna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi LM,
Thanks for your suggestion ,I tried your solution but i am facing same problem.
Thanks & Regards
muna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Hi VS,
value variable is not declared .Can you tell me which type value variable is.
Thanks & Regards
muna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Message was edited by: Valery Silaev
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I suggest the following.
Under Node Birthdaylist(node from where your data for the table is coming), create a value attribute (instead of creating in the context). For this value attribute, calculate text view design based on currentElement value.
Set the property against this value attribute.
Cheers,
LM
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.