cancel
Showing results for 
Search instead for 
Did you mean: 

bind bound oData function to UI5 control

akuller
Participant
0 Kudos
282

Hi all,

 

i want to bind a bound function to an control as described here: https://sapui5.hana.ondemand.com/sdk/#/topic/b54f7895b7594c61a83fa7257fa9d13f

we have great examples for unbound functions:

 

<VBox id="getAvailableItems" binding="{path : '/GetAvailableItems(...)', parameters : {$select : ['ProductName', 'ProductId']}}">
    <List id="xyz" items="{value}">
        <items>
            <ObjectListItem title="{ProductName}" />
        </items>
    </List>
</VBox>

 

but for bound functions only the js part is referenced:

 

var ...
    oSalesOrderContext = oTable.getSelectedItem().getBindingContext(),
    oAction = oModel.bindContext("name.space.InvoiceCreated(...)", oSalesOrderContext);
 
oAction.invoke()...

 

I've been trying to do this directly with a binding in the xml view for some time now, but it doesn't work. Has anyone got it working?

View Entire Topic
junwu
Active Contributor

did you check this?

https://sapui5.hana.ondemand.com/sdk/#/topic/b54f7895b7594c61a83fa7257fa9d13f

the binding path in your xml should be something like this(I haven't tried.),

var oContext = oModel.createBindingContext("/EMPLOYEES('1')/##com.sap.gateway.default.iwbep.tea_busi.v0001.AcSetIsOccupied");

akuller
Participant
0 Kudos
Hi @junwu i know this chapter, i have also linked it above. my question, however, is whether i can bind a bound function directly in the xml view. As shown in the example for an unbound operation, without js code. Unfortunately it's not working for me.
junwu
Active Contributor
0 Kudos
show me what you did
akuller
Participant
0 Kudos

Hi @junwu

eg:

<VBox id="getAvailableItems" binding="{path : '/getHierarchy(...)', parameters : {$select : ['ID', 'Name']}}">
    <List id="xyz" items="{value}">
        <items>
            <ObjectListItem title="{Name}" />
        </items>
    </List>
</VBox>

 

add a namespace to the path, remove all parameters, bind only the path, ...

I really only want to do this for a bound function without js code

junwu
Active Contributor
0 Kudos
then, did you read what I wrote regarding the path?
akuller
Participant
0 Kudos

Hi @junwu

Yes, it works, but the # is wrong. But that's not my question. I already have a context and want to access the bound function from it.
I come from the list report to the object page, where I have my own fragment in which I define my table. Here it should derive the context independently without js coding from me.