cancel
Showing results for 
Search instead for 
Did you mean: 

Bind data to table after context modified

Joseph_BERTHE
Active Contributor
0 Kudos

Hello,

I have three UI components which have reference to a node of a context. I call a BAPI which I modify its data to set it up inside my context.

My problem is when I do that, nothing happen to my UI Components. It seams that my UI Components need to be refresh or something like that.

I've tried to make :

<i>IWDTable myTable = (IWDTable)view.getElement("Table");

myTable.bindDataSource("wdcats_admin");</i>

That works, but i have to be in each views to do that.

Is there a refresh method or process to bind my new data from my context to all UI Components.

Thanks

Regards,

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

If the UI elements are bound to the correct context node attributes and those attributes' values change, the UI elements should pick up the new values automatically. This is the advantage to having them bound to the context. Are you calling the invalidate method after the BAPI has been executed? Are the UI elements bound to the output of the BAPI or some other context attributes?

-Cindy

Joseph_BERTHE
Active Contributor
0 Kudos

My UI Elements are all bounded to the same node of my context. But the output node of my BAPI is different (and of course invalidated), because I need to make some data changing on the BAPI's data. And after, I update the node of my UI elements with the new values.

By the way, I'm completely agree with you when you said it is the advantage of the context, but actually with that use it doesn't fit well.

With my debugger, I can see all my data stored in the well node, but my calendar and my tables do not seem to realize that data has been changed.

Former Member
0 Kudos

Please post the context structure and binding of UI elements. Explicit refreshing of UI element bindings is never needed.

Armin

Former Member
0 Kudos

So the UI elements are bound to a context node that is populated through code by pulling data from the BAPI output? If that is the case, you may need to check on that code (or post it so we can see how you are doing it and possibly help). If you are replacing elements within the node or creating new ones (to replace the old ones), you can create a collection of the new elements and then bind them to the node. If you are just updating values within existing node elements, the UI elements should pick up the new values automatically.

Hope this helps.

-Cindy

Joseph_BERTHE
Active Contributor
0 Kudos

Ok guys, let me show you :

<b>My Context :</b>

|-BAPI_OUTPUT

' +-Value_A

'

+-NODE_ROOT

+-NODE_DATA

|-Value_B

+-Value_C

<b>Node Properties :</b>

BAPI_OUTPUT => card 0..n

NODE_ROOT => card 1..n

NODE_DATA => card 1..n | singleton FALSE

<b>My code to get data from BAPI to NODE_DATA :</b>

IPublicMYPROJECT.IBAPI_OUTPUTElement bapiElem = wdContext.currentBAPIOUTPUTElement();

IPublicMYPROJECT.IBAPI_OUTPUTNode bapiElem = wdContext.nodeBAPIOUTPUT();

IPublicMYPROJECT.INODE_ROOTElement rootElem = null;

IPublicMYPROJECT.INODE_DATAElement dataElem = null;

bapiNode.moveFirst();

wdContext.nodeNODE_ROOT().moveFirst();

do{

// Set the position to the current element of the BAPI

bapiElem = wdContext.currentBAPI_NODEElement();

// Set my data

dataElem = wdContext.createNODE_DATAElement();

dataElem.setValue_B(bapiElem.getValue_A);

...

// Record my dataElem to a new node

wdContext.nodeNODE_DATA().addElement(dataElem);

// Create a new ROOT_NODE element

rootElem = wdContext.createROOT_NODEElement();

wdContext.nodeROOT_NODE().addElement(rootElem);

wdContext.nodeROOT_NODE().moveLast();

}while(wdContext.nodeNODE_DATA().moveNext() != null);

wdContext.nodeROOT_ELEM().setLeadSelection(0);