cancel
Showing results for 
Search instead for 
Did you mean: 

Table UI element refresh problem

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks Valery,

I am populating the table using node.bind().

Regards

Vinay Rane

Former Member
0 Kudos

Vinay,

So you call: node.bind( someCollection );

Could you post exact code how this "someCollection" is created? Probably you are collecting duplicate entries here...

VS

Former Member
0 Kudos

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;

}

}

}

Former Member
0 Kudos

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

http://www.NetWeaverTeam.com

Former Member
0 Kudos

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

Former Member
0 Kudos

Vinay,

Something wrong here: if your data source is ContextValueNodeResponse.Question then table will always show just one element of node Qestion...

VS

Former Member
0 Kudos

Valery,

I tried changing the table data source to ContextValueNodeResponse, the output reamins to be same as before.....

Appreciate your efforts in guiding me..

Thanks,

Regards

Vinay Rane

Former Member
0 Kudos

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

Answers (0)