on 04-14-2006 11:20 AM
Hi ,
I have a scenario where in I am retreving data from a data base table using ejb . I have a single view with 3 input fields to collect inputs for selection of records. The returned records are displayed in the table. The data retrival is triggered at the click of a button on the same view. The data retrival part is working fine. However for every successive click on the button after the first click, the new records are appended in the table, with old data still displayed in the table. I would like to have only the records selected based on the inputs to be displayed I have tried using
wdContext.getContext().reset(true)
and wdContext.....invalidate();
to reset the context.
It seems like the Table is not cleared .
I am looking forward for guidance/advice from the SDN members in resolving this problem.
Vinay,
First, dont use call "wdContext.getContext().reset(true)" here: it removes dynamically created attributes / nodes, node invalidation is something different.
Second, how do you populate Table node? Is it done via supply function, or manually via node.bind()?
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Valery,
Below is the code in my action to retrive data,
public void onActiongetData(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActiongetData(ServerEvent)
ResponseLocal[] Response ;
Response =this.wdContext.currentWebSurveyCmdBeanElement().modelObject().getCollResponse();
int it = Response.length;
int counter=0;
IPrivateWebSurveyComponentView.IContextValueNodeResponseElement newcontextValueNodeElement;
IQuestionElement newQuestionNodeElement;
this.wdContext.getContext().reset(true);
this.wdContext.currentContextValueNodeResponseElement().nodeQuestion().invalidate();
while(counter < it) {
ResponseLocal objRespBean ;
objRespBean = Response[counter];
newcontextValueNodeElement=wdContext.createContextValueNodeResponseElement();
wdContext.nodeContextValueNodeResponse().addElement(newcontextValueNodeElement);
newQuestionNodeElement = wdContext.createQuestionElement();
newQuestionNodeElement.setQuestionNo(objRespBean.getPFldQuestionNo());
newQuestionNodeElement.setResponseValue(objRespBean.getPFldResponseValue().toString());
newQuestionNodeElement.setUpdateDate(objRespBean.getPFldUpdateDate().toString());
newQuestionNodeElement.setUpdateTime(objRespBean.getPFldUpdateTime().toString());
newcontextValueNodeElement.nodeQuestion().bind(newQuestionNodeElement);
counter =counter+1;
}
}
}
Vinay,
Let me clarify some points:
You have the following context:
-- Context
+- <Probably some intermidiate signleton node/nodes>
+- ContextValueNodeResponse (0..n)
+- Question (0..1, non-singleton)
What node is used as table "dataSource"? Is it node ContextValueNodeResponse?
Also what I see from your coding, you are invalidating node <b>Questions</b>, but do not invalidate <b>ContextValueNodeResponse</b>. So, in effect, you are adding more and more ContextValueNodeResponse elements (and hance more and more questions).
To fix this try
this.wdContext.nodeContextValueNodeResponse().invalidate();
instead of this 2 lines:
this.wdContext.getContext().reset(true);
this.wdContext.currentContextValueNodeResponseElement().nodeQuestion().invalidate();
Valery Silaev
EPAM Systems
Valery,
I tried by invalidating ContextValueNodeResponse, there was no change in the results....
Data Source for my Table is: ContextValueNodeResponse.Question
The Context Structure is
-- Context
+- ContextValueNodeResponse(0..n) signleton node/nodes>
+- Question (0..1, non-singleton)
QuestionNo (Value Attr)
ResponseValue
UpdateDate
UpdateTime
Message was edited by: Vinay Rane
Message was edited by: Vinay Rane
Message was edited by: Vinay Rane
Thanks Valery,
As suggested By you, by correcting the node to be invalidated the problem is resolved. Earlier I had included your suggestion to use this.wdContext.nodeContextValueNodeResponse().invalidate(); and executed but the results were not as expected.
However later when I executed in debug mode it worked as expected. I build the project and then executed and it is working. Thanks Valery for your guidance....
Regards
Vinay Rane
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.