sapui5 - What's the usage of setBindingContext() and the difference from element binding? -


in 1.5.2.3 defining binding path section of openui5 demokit:

a context exists either each entry of aggregation in case of aggregation binding or can set explicitly control using setbindingcontext method.

in 1.5.3.3 element binding section of openui5 demokit:

element binding allows bind elements specific object in model data, create binding context , allow relative binding within control , of children.

it seems me 2 techniques same thing. both create binding context control bindings of containing controls resolve relatively it. what's difference between them? in scenario either of them come play?

setbindingcontext doesn't work in following code:
https://jsbin.com/bigope/edit?html,output
however, if change opanel.setbindingcontext("/nameinfo"); opanel.bindelement("/nameinfo");, works, why?

setbindingcontext requires pass context, this:

opanel.setbindingcontext(new sap.ui.model.context(omodel, "/nameinfo")); 

the difference between 2 conceptual. binding context used parent context bindings (for model) in control or children. holds reference used model, (a part of) path , optional parent context. used when creating relative bindings.

the bindelement method on other hand behaves every other bind* method. creates binding (in case, contextbinding) allows change events, data binding, etc. additionally created contextbinding serves bindingcontext other bindings, context added setbindingcontext do.

not confusing @ all, right ;)?

reading code managedobject might understand internals better. (bindobject = bindelement)


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -