openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

XML Composite control - Can't get getBinding("items") when using forwarding

Open uxkjaer opened this issue 7 years ago • 7 comments

OpenUI5 version: 1.67.0

Browser/version (+device/version): Chrome, Desktop ver: 75.0.3770.100

Any other tested browsers/devices(OK/FAIL): N/A

URL (minimal example if possible): https://sapuicoresamplexmlcomposit-c16839e8f.dispatcher.ap1.hana.ondemand.com/index.html

Steps to reproduce the problem:

  1. Load the above url
  2. Open the debugger
  3. Press one of the buttons

What is the expected result? The binding for the items should be added to the console What happens instead? undefined is added to the console

uxkjaer avatar Jul 16 '19 01:07 uxkjaer

I'm trying to use this binding to add the attachDataRecieved event so I can work with the data.

uxkjaer avatar Jul 16 '19 01:07 uxkjaer

Hi,

could you please show me how you defined your composite? Is the template loaded synchron or asynchron?

Regards

Silkinator avatar Jul 16 '19 08:07 Silkinator

You should be able to see everything if you enable debug. It's the same example as the open ui5 just bound to the northwind service instead.

On Tue, 16 Jul. 2019, 18:21 Silke Spang, [email protected] wrote:

Hi,

could you please show me how you defined your composite? Is the template loaded synchron or asynchron?

Regards

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SAP/openui5/issues/2589?email_source=notifications&email_token=AB6OUAXGTFL37I47HDASEWDP7WAJNA5CNFSM4ID4JFA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2AC2QA#issuecomment-511716672, or mute the thread https://github.com/notifications/unsubscribe-auth/AB6OUAVTHLSQB6GP5QLGKYDP7WAJNANCNFSM4ID4JFAQ .

uxkjaer avatar Jul 16 '19 08:07 uxkjaer

I've added the code here https://github.com/kovboyjder/OpenUI5-Composite-control-error

uxkjaer avatar Jul 19 '19 00:07 uxkjaer

Sorry I do not get you here. The behavior is pretty correct the inner table has no binding you did not define any here. This is not the way aggregation forwarding works.

@akudev could you clarify? The binding is forwarded correctly to the innter table but the inner table does not have the binding, while the composite has. This is correct isn't it?

Silkinator avatar Jul 19 '19 08:07 Silkinator

You can use .getAggregation("items") based on https://openui5.hana.ondemand.com/#/api/sap.ui.base.ManagedObject/methods/sap.ui.base.ManagedObject.extend I am forwarding to SAPUI5 development to check the case where aggregations are forwarded and bindings are not #1970505253

stephania87 avatar Oct 09 '19 15:10 stephania87

Hi Jakob,

sorry for the long delay... internal handover of topics and I don't get informed on mentions.

But well, it is like Silke wrote: with aggregation forwarding there is either a binding on the outer aggregation (like in your case); all removals or additions etc. of items are then forwarded one-by-one to the inner aggregation. Or forwardBinding=true is set on the aggregation forwarding; then the binding happens directly on the inner aggregation (and the outer aggregation does not get any mutation calls). But in any case there is only ONE binding.

As you leave the binding on the outer aggregation, this is where you would need to call getBinding(...), like Stephania wrote, and I assume this works. So I'll close this issue for the time being. Let me know if this is not clear or is a problem for your use-case.

See also https://jsbin.com/rakimen/1/edit?html,output for a working example (thanks to Stephania for creating this snippet!)

Regards Andreas

akudev avatar Oct 14 '19 16:10 akudev