cancel
Showing results for 
Search instead for 
Did you mean: 

How to do element binding in xml fragment in UI5 application

Former Member
0 Kudos

Hi guys,

I've raised a question which is bothering me so much on stackoverflow:

http://stackoverflow.com/questions/31624500/how-to-do-element-binding-in-xml-fragment-in-ui5-applica...

I don't want to copy paste again and reformat again because it's very long, sorry for that.

Any help will be very much appreciated.

thanks.

Regards,

Aaron

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

try

<core:Fragment binding="{path:'Creator'}" fragmentName="xxx.fragment.User" type="XML"/>


or


move a contanier one level up and do a binding for controller in the view where you use it

Former Member
0 Kudos

Hi Maksim,

Thanks, binding on fragment doesn't work, but wrap the fragment in a container and set the binding path of the container works.

one question though:

where do you find these xml binding syntax? I mean how do you know there's a "binding" attribute available for set binding path?

I run through the documentations, but I can't find anything about it.

Regards,

Aaron

former_member182372
Active Contributor
0 Kudos

Where...well, in debris of sapui5 source code it is sap, there is always a gap to keep independent consultants like me busy

Former Member
0 Kudos

haha, ok, got it.

Thanks!

AndreasKunz
Advisor
Advisor
0 Kudos

Hi,

<core:Fragment> itself (or sap.ui.core.Fragment) is not a control and has no representation at all in the runtime UI structure. I guess this is why settings on such an element in an XML View are not handled.

I'll check whether this can be documented explicitly.

Regarding the "binding" attribute: yeah, this was added two years ago in the XMLView parser, but not documented so far AFAIK. But documentation on how data binding is used in XMLViews has been generally missing and this gap is about to be filled - the documentation is currently in review and I saw that the "Element Binding" section in it will explain this attribute...

Regards

Andreas

Answers (1)

Answers (1)

Former Member
0 Kudos

sap.ui.getCore().byId("idInFragment").setModel(oModel);

This will work. Cheers:-)

Former Member
0 Kudos

Siddhartha, I'm not sure if you go through my question. I'm not asking how to set the model.