cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 binding path features

Former Member
0 Kudos

Hi,

I'm currently looking for information regarding the features available in sapui5 binding paths. When looking at https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/BindingElements.html (the master details example) it looks like there is support for index based access in json arrays but haven't found any official statement in the documentation. Also a thing that would be very useful IMHO is some kind of pattern matching support (like ant path patterns or like globbing in unix shells) in binding paths to access for instance nested content for a unknown key. Are there any plans for supporting such functionality? Regarding the current syntax for model access (model name followed by '>') there has to be some support already available. Would also be cool if the documentation gets improved to explain the supported features better.

Best regards,

Tobias

Accepted Solutions (1)

Accepted Solutions (1)

pmuessig
Advisor
Advisor
0 Kudos

Hi Tobias,

regarding the index based access. This works fine only for JSON models. In the case you have an array containing objects you would be able to access those entries via the index in the binding path: /0/myKey.

Our databinding already supports relative paths. E.g. if you bind the values of a TextField against the properties of and object inside an array you would do this relative:

     oModel.setData({modelData: [ {"prop1": ""}, {"prop1": ""}, {"prop1": ""}, {"prop1": ""}]});

     var oField = new sap.ui.commons.TextField({value: "{prop1}"});

To now make a valid binding you can set the binding context of that TextField to the first entry. This is what you typically would do for master details scenarios. In case of the Table or a Dropdown you could get the binding context of the selected row or item and apply it on the field:

     oField.setBindingContext(oItem.getBindingContext());

or you could do so manually via bindElement - it allows you to specify a binding context path:

     oTextField.bindElement("/modelData/1");

The last point you mentioned is the multimodel support. I will take this point. Maybe some hints here:

     oControl.setModel(oModel, "myModel");  // sets a named model

     oControl.bindText("myModel>/prop1");  // bind the property prop1 to the text prop of the control

In 1.8 we do not support aggregation binding for named models t.m.k. This will come with 1.10. I will check again.

Best regards,

Peter

Former Member
0 Kudos

Hi Peter,

thanks for your explanation. For me its ok to have certain features only available if the used model supports it (as long it is mentioned in the documentation).

Best regards,

Tobias

rakshetha_jn
Associate
Associate
0 Kudos

hi I have similar situation

if i have a single model but with nested entries , how should i bind my columns to the respective paths

I want a table with columns id and age ,the model is nested

id -> data/one/id

age -> data/two/age

var demoJSONModel = new sap.ui.model.json.JSONModel({

  data :{one:[

    { id : 42,pos:'-' },

    { id : 1.618,pos:'-'  },

    { id : 3.14,pos:'-'  }

  ],two:[

    {age:43},

    {age:41},

    {age:40}

  ]}

});

oView.setModel(demoJSONModel);

oView.placeAt("content");

<core:View

    xmlns:core="sap.ui.core"

    xmlns="sap.ui.commons"

    xmlns:table="sap.ui.table"

    xmlns:html="http://www.w3.org/1999/xhtml"

    controllerName="view.Main">

    <Panel text="Hello World from an XML view">

        <Button text="Button" press="doSomething"></Button>

        <table:Table width="100%" visibleRowCount="5" selectionMode="Single" editable="false" rows="{/data}">

            <table:title><Label text="Wochentage"></Label></table:title>

            <table:Column>

                <Label text="ID" />

                <table:template><TextField value="{/one/id}"></TextField></table:template>

            </table:Column>

<table:Column>

                <Label text="ID" />

                <table:template><TextField value="{/two/age}"></TextField></table:template>

            </table:Column>

        </table:Table>

    </Panel>

</core:View>

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello, i'm a experienced Sap dev but a noob noob SAPUI5 dev, so i'm facing a lot of problem regarding SAPUI5, even with a lot of examples. Here is my Problem :

I retrieved values from the getSelectedContextPaths()....

i want to get the value of an element in one of the array line :

  1. "SelectedPath ": Array[2]

    1. 0: "/Unassigned_TransactionsSet(Mandt='300',ErpCode='PM6_600 - SAP CEP',InvoiceId='6300002499',InvoiceItemId='2')"
    2. 1: "/Unassigned_TransactionsSet(Mandt='300',ErpCode='PM6_600 - SAP CEP',InvoiceId='6300002500',InvoiceItemId='3')"

But i don"t know how to do this . Please Help !

Regards

Laurent

sohailkhan
Explorer
0 Kudos

did you get the answer please share with me also

Former Member
0 Kudos

Hi,

aggregation binding for named models is supported since 1.10.

Regards

Johannes

Former Member
0 Kudos

Hi Johannes,

since 1.10 should be released in mid march (at least to my knowledge) I assume this can be used starting from thursday this week?

Best regards,

Tobias

pmuessig
Advisor
Advisor
0 Kudos

Hi Tobias,

we had a timing issue beginning of March with the UI5 1.10 release and NW cloud. On Thursday we will start to push UI5 1.10.2 which will be then available on 29th of March to my knowledge. Sorry for this delay...

Best regards,

Peter

Former Member
0 Kudos

Hi Peter,

thanks for the information. The delay won't be a show stopper for us. Short question slightly off topic: I don't know what the SAP policy is here but would it be possible to share a rough development roadmap for sapui5 with the community? I think there is definitely an interest in the features which are currently in the pipeline and when to expect a release of those. Also it would be cool to get access to the current development version of sapui5 to play around with new features and provide feedback or open bug reports (I think a ticket system/bug tracker is currently in preparation?).

Best regards,

Tobias

Former Member
0 Kudos

Hi ,

is there an news on the relaese?

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/c08465d5-b833-2f10-e59d-f67a5c...

is still pointing to 1.8.4.

Thanks a lot for an update.

Regards,

Stefan

Former Member
0 Kudos

Hi Stefan,

sapui5 version 1.10.2 has been released and deployed to the hana cloud last week. If you want to use the sapui5 jars for this release in a web application you'll have to wait until april 11th because the hana tools update site still contains version 1.8.9 (see http://scn.sap.com/thread/3334569).

Best regards,

Tobias

Former Member
0 Kudos

Hi Tobias,

thanks for the information!

Is it possible to use the update site

https://tools.hana.ondemand.com/juno (as it is stated for SAP HANA Cloud) for SAPUI5 development as well? Or is there another remote update site for SAPUI5?

Thanks!

Former Member
0 Kudos

Hi Stefan,

can you explain what you understand by 'SAPUI5 development'? In fact the eclipse update site you mentioned is the one I named hana tools update site. If you point eclipse to this location you'll be able to install tooling for creating web applications with sapui5 interfaces. Note that you can also write applications which don't include the sapui5 runtime but use the runtime deployed at the hana cloud (https://sapui5.netweaver.ondemand.com/sdk/) and define some local resources (see https://sapui5.hana.ondemand.com/sdk/#docs/guide/ModularizationConcept.html).

Best regards,

Tobias

Former Member
0 Kudos

Hi Tobias,

thanks for the links!

normally, the starting point for SAPUI5 development is here:

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/c08465d5-b833-2f10-e59d-f67a5c...

Within this zip file there is also an folder called "tools-updatesite" which contains the actual eclipse plugin and therefore the actual SAPUI5 libraries. At the moment this is 1.8.4.

I wondered if this approach (downloading, unpacking that "tools-updatesite" folder, etc.) could be simply replace with a normal update site url, which hosts the actual version of the SAPUI5 eclipse Plugin.

So thinking about that, my question was whether the url https://tools.hana.ondemand.com/juno could be used to always have the actual SAPUI5 eclipse plugin available. I'm only interested in the actual eclipe plugin for SAPUI5, Hana Tools is not crucial.

When I got you right, your tip was to include the core library directly, e.g. https://sapui5.netweaver.ondemand.com/sdk/resources/sap-ui-core.js. That would be a solution for runtime, but then I would not get the code completion and help texts in eclipse. For me as a beginner, they are quite essential. 🙂

So, therefore I asked if there is a difference (except of course the version at present) between the eclipse plugin for SAPUI5 contained in the Hana tools compared with the plugin in the "tools-updatesite" folder.

Regards,

Stefan

Former Member
0 Kudos

Hi Stefan,

I don't really know whether there is a difference in the tooling since I started right away with the sapui5 tooling from the cloud update site. When using this update site you can choose to only install the sapui5 feature. This includes the runtime jars and the tooling so you'll get everything you need.

Best regards,

Tobias

Former Member
0 Kudos

Hi ,

can you tell us, if there is a difference in the sapui5 tooling? Is it possible to take the hana tools eclipse update site, for having the actual sapui5 eclipse plugin?

Regards

Stefan

AndreasKunz
Advisor
Advisor
0 Kudos

Sorry, I'm not fully aware what is inside which package.

I asked colleagues to have a look.

Regards

Andreas

pmuessig
Advisor
Advisor
0 Kudos

Hi Stefan,

this is only an evaluation package at the moment. We do not update it regulary at the moment. Our main shipment is happening through the cloud either as deployed app or as Eclipse tooling. We discussed this already to provide a newer version here.

I will try to find an answer soon.

Best regards,

Peter

pmuessig
Advisor
Advisor
0 Kudos

Hi Stefan,

If you mean the HANA Cloud Tools update site, then yes - it contains the UI5 eclipse plugins and runtime components. On Thursday also in the version 1.10.3 - if all works fine.

Best regards,

Peter

0 Kudos

Hi Andreas,

we have different distribution channels which differ in their installation behavior and compatibility. In general it is not recommended to mix installations from different distribution channels. I.e. you should first uninstall the version from the SCN beta shipment and then install it from the cloud updatesite. Otherweise you could get strange errors during update.

The available channels are:

- Service Market Place: Zip-Download of the updatesites containing the latest released version. Required Eclipse features have to be installed manually in advance.

- Cloud update site: Latest released version. Installs everything needed automatically. Best user experience. The ABAP repository connector is not yet included but this is planned for SAPPHIRE.

- SCN Shipment: Contains a zipped update site. Is not up to date

- SAP Internal update site: Contains the latest development versions

Best regards

Matthias

Former Member
0 Kudos

Hi Matthias,

is the SAP Internal update site available for consumption by SAP partners?

Best regards,

Tobias

0 Kudos

Hi Tobias,

it is only available within the SAP network.

For partners I would recommend to use the released versions.

Best regards

Matthias

Former Member
0 Kudos

Hi Peter,

it worked all fine then! UI5 eclipse plugins and runtime components on 1.10.3 now!

Thanks a lot!