cancel
Showing results for 
Search instead for 
Did you mean: 

Page redraw not updating clientAPI.binding?

pascal_ducaule
Explorer
0 Kudos
865

Hi,

When I update some data in the background then call a redraw() on the current mdk page to refresh the page, I noticed that only controls which have an EntitySet Target defined on those data get refreshed.

Other UI element based on a rule that gets the clientAPI.binding object do not get refreshed that way. They remain "bound" to the object entity they received when rendering the page the first time.

What am i doing wrong? How could I refresh this binding so that the UI elements are updated accordingly?

What would be the best practice to refresh all UI elements in that page?

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

pascal_ducaule
Explorer
0 Kudos

Hi,

I have issue setting the new updated entity to my pageProxy binding as you suggested.

pageProxy.binding = newUpdatedEntityObject; -> does not work

Based on documentation there is only a Getter (no Setter) for that binding property.

How can i bind that new object to my pageProxy?

Thanks

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Use setActionBinding and then redraw the page.

pageProxy.setActionBinding(binding);
pageProxy.redraw();
mingkho
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Pascal,

My apologies, I tested by modifying the property in the binding directly, assuming the binding itself is also modifiable.

In that case you can try Bill's suggestion or you will need to modify the property of the binding directly: e.g.

pageProxy.binding.ProductName = newUpdatedEntityObject.ProductName;

pageProxy.binding.ProductDescription = newUpdatedEntityObject.ProductDescription;

and so on.

Regards

Ming

pascal_ducaule
Explorer
0 Kudos

Thanks Ming - this solves my issue. (Although I was trying to design a more "generic" approach to refreshing some pages using the same method)

For information - Bill's suggestion does not work in this scenario - unless I call a Navigation action on the same page after the pageProxy.setActionBinding(binding)

Regards

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Pascal,

What version / platform are you using? I tested my version and it worked for me without navigating.

pascal_ducaule
Explorer
0 Kudos

Hi Bill - Sorry I missed that last comment.

Actually the only "refreshed" UI elements when calling a redraw are the ones with a DataBound Container (for which you can specify a Design Target Entity.

If - for example - I have a Simple Button whose Title value depends on the bound entity then it will not be refreshed on redraw - which kinda makes sense as this button is not likely to be "re-rendered" when the bound entity changes.

Pascal

pascal_ducaule
Explorer
0 Kudos

Thanks - indeed I'm not using MDK oData action.

I will update this binding manually as you suggested.

mingkho
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Pascal

This will depends on how you update your data in the background. Typically, if you updated your data via one of the MDK OData actions, the refresh of the data in the page would have been taken care of automatically by the Data Subscription. This is assuming the entity you updated are related to the entity bound to your page. If it's not related, then you'd need to manually add custom DataSubscription on your page / sectioned table level to the specific EntitySet you are updating, that way when that entityset is updated, we'll redraw your page and refresh the binding accordingly.

But if you are not using MDK OData actions, thus can't make use of the Data Subscription, then you can also manually update your PageProxy's binding (because that's the binding of the page) before you call the redraw.

e.g.

pageProxy.binding = newUpdatedEntityObject;

pageProxy.redraw();

Regards

Ming