cancel
Showing results for 
Search instead for 
Did you mean: 

Refreshing UI Elements

Former Member
0 Kudos

Dear developers,

What is the general way to refresh a UIElement when one of its "source" binding has changed? Rebind the source ? Is there any "hidden" call somewhere that can be performed?

Regards,

Olivier MATT

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

after each event (F4, button event,...) the bindings get refreshed,

so when you refresh your binding, you should go by wdmodifyview,

after your serverevent it will be changed

grtz

Koen

Former Member
0 Kudos

Hi Koen,

So do you mean I should call WDMODIFYVIEW manually?

Regards,

Olivier MATT

Former Member
0 Kudos

Hi,

i mean that when you change the source, you probably read the context,

into local variable to change it, you should then bind the changed local to

the context again, replacing the old values something like

node->get_attribute

change attribute

node->set_attribute

grtz,

Koen

Former Member
0 Kudos

Hi,

Let me ask the question differently. How can be a UI element be refreshed when the data inside the context has changed?

Has the WD4A framework a listener on the M of the MVC ?

Second question, how I can recall the supply method of my Table UI Element ?

I just want to modifiy the content of the table and I have no precise idea of what is the best way to achieve it.

Any idea?

Sincerely,

Olivier MATT

Former Member
0 Kudos

Hi Olivier.

1. If you just change the value of an context attribute which is bound to any UI-

Element, the UI-Element gets refreshed automatically if your change triggers a

roundtrip. So If you change the value inside an action for example the UI-ELement

will be updated.

2. The supply method is only called once that is in the moment the context node

changes by adding a new element. But a supply method is not a must. You can

fill the context node with elements or change a certain element in any method

(action, inbound plug) you want to by getting a refernce to the node and bind a

table for example. But as hack you can call the supply method directly which is

not the best design I guess ...

But from your initial post I had the feeling you want to know how to refresh the UI-

Element if the binding of one of its attributes changes to another context

node/attribute, right?

I would guess that if you change the binding by calling:

lr_uielement->bind_*( 'NODE.ATTRIBUTE' )

the change should be visible directly after the roundtrip was triggered.

Cheers,

Sascha

Message was edited by:

Sascha Dingeldey

former_member215843
Active Participant
0 Kudos

Hi Olivier,

The UI elements are automatically refreshed, if the values of the bound context node change. So there is no need to do anything.

If you change anything else, you sometimes have to make sure that the context node is updated.

You have different possibilities:

- You change the content of the context node. This makes sense, if you know exactly what must be changed.

- You invalidate the context node. Then the supply function is automatically called again, whenever the node is used. Just call method

invalidate( )

on the context node.

Ciao, Regina

Former Member
0 Kudos

Hi Sascha,

Thank you again for this precise answer

I solved my problem again. So from what you said there is somehow a "listener" from the V to the M. At least it seems so.

What is the hack to call the supply method ? (I will not use it but ... I am curious )

Anyway, have a good day,

Regards,

Olivier MATT

Former Member
0 Kudos

Hi Regina,

Thank you. So WD4A has a listener on the V to the M.

Very good to hear.

Best Regards,

Olivier MATT

PS: is it more CPU costly to invalidate and recall the supply method or to change the data of the context node?

Former Member
0 Kudos

Hi Regina.

But to see the changes a rountrip is needed, isn't it? Which is triggered anyway when you change context in an action handler.

Cheers,

Sascha

Former Member
0 Kudos

When you have a look at the interface of a supply method you see that it takes

the context node to fill and the parent element.

So you just need to get references to the node and element and you can

call the method:

supply_something(

node = lr_mynode

parent_element = lr_parent_element

).

Cheers,

Sascha

former_member215843
Active Participant
0 Kudos

Hi Sascha,

Please do NOT call supply methods, action handler or the other hook methods manually. This could lead to unpredictable results. Even if this works today, it may not work in the future, and we cannot guarantee that it works.

Ciao, Regina

Former Member
0 Kudos

Hi Regina.

I do not call them .. I he was just curious how to do this. As I mentioned it above this is not the way to do it.

Cheers,

Sascha

Message was edited by:

Sascha Dingeldey

Answers (0)