$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
0

sap.m.select binding in xml view using expand query in sapui5

Dec 06, 2016 at 06:42 PM

115

avatar image

Hi, We need to bind some data to a sap.m.select and so we implemented the expand query in our backed and it seems to work properly returning the content of the sap domain

<link href="CampiSet('AGTITLE_MEDI')/DominiSet" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/DominiSet" type="application/atom+xml;type=feed" title="DominiSet">
<m:inline>
    <feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="http://our.service/ZOUR_SERVICE/">
        <id>http://our.service/ZOUR_SERVICE/CampiSet('AGTITLE_MEDI')/DominiSet</id>
        <title type="text">DominiSet</title>
        <updated>2016-12-06T18:10:59Z</updated>
        <author>
            <name/>
        </author>
        <link href="CampiSet('AGTITLE_MEDI')/DominiSet" rel="self" title="DominiSet"/>
        <entry>
            <id>http://our.service/ZOUR_SERVICE/DominiSet(Id='AGTITLE_MEDI',Key='')</id>
            <title type="text">DominiSet(Id='AGTITLE_MEDI',Key='')</title>
            <updated>2016-12-06T18:10:59Z</updated>
            <category term="ZOUR_SERVICE.Domini" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
            <link href="DominiSet(Id='AGTITLE_MEDI',Key='')" rel="self" title="Domini"/>
            <content type="application/xml">
                <m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
                    <d:Filtervalue/>
                    <d:Id>AGTITLE_MEDI</d:Id>
                    <d:Key/>
                    <d:Value/>
                </m:properties>
            </content>
        </entry>
        <entry>
            <id>http://our.service/ZOUR_SERVICE/DominiSet(Id='AGTITLE_MEDI',Key='32')</id>
            <title type="text">DominiSet(Id='AGTITLE_MEDI',Key='32')</title>
            <updated>2016-12-06T18:10:59Z</updated>
            <category term="ZOUR_SERVICE.Domini" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
            <link href="DominiSet(Id='AGTITLE_MEDI',Key='32')" rel="self" title="Domini"/>
            <content type="application/xml">
                <m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
                    <d:Filtervalue/>
                    <d:Id>AGTITLE_MEDI</d:Id>
                    <d:Key>32</d:Key>
                    <d:Value>AMB. VETERINARIO</d:Value>
                </m:properties>
            </content>
        </entry>
        <entry>
            <id>http://our.service/ZOUR_SERVICE/DominiSet(Id='AGTITLE_MEDI',Key='12')</id>
            <title type="text">DominiSet(Id='AGTITLE_MEDI',Key='12')</title>
            <updated>2016-12-06T18:10:59Z</updated>
            <category term="ZOUR_SERVICE.Domini" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
            <link href="DominiSet(Id='AGTITLE_MEDI',Key='12')" rel="self" title="Domini"/>
            <content type="application/xml">
                <m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
                    <d:Filtervalue/>
                    <d:Id>AGTITLE_MEDI</d:Id>
                    <d:Key>12</d:Key>
                    <d:Value>AVVOCATO</d:Value>
                </m:properties>
            </content>
        </entry>

We then use XML view in our frontend for trying to bind this dataset to a sap.m.select in this way

<Select id="AGTITLE_MEDI" items="{/CampiSet('AGTITLE_MEDI')/DominiSet}"><core:Item text="{Value}" key="{Key}"></core:Item></Select>

And then we bind all our data using view.bindElement this way

view.bindElement({path: "/Entity?$filter=Vkorg eq '2000' and Vtweg eq '10' and Process eq '02'&$expand=DominiSet"});

This worked quite well for a lot of time but then we added a lot of sap.m.select and we noticed that the framework made a lot of request to the backend slowing down the application.

I kindly ask how we can bind this data using the expand query so that the framework will make only a single request instead that once for items aggregation, we are currently trying different method to bind data but we are unable to make it happens.

Are we making something wrong on the backend side? Or our view are wrong?

Thanks for the attention.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers