$(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
1

How to set templateShareable while/before cloning

Feb 28, 2017 at 06:03 AM

699

avatar image

Hi Experts,

In the controller.js, i have written a clone statement like this:

var oView = that.getView().byId("aggregatedView").clone(); // i need a cloning here to avoid loosing the existing binding

oView.bindItems({
path: "/ZEntity",
template: that.getView().byId("aggregatedViewItems"),
filters: aFilters });

I am receiving an error as described here:

During a clone operation, a template was found that neither was marked with 'templateShareable:true' nor 'templateShareable:false'. https://sapui5.hana.ondemand.com/sdk/#docs/guide/3a4a9e562988456c9be0ef883ae7da50.html


I know i have to set templateShareable to either false or true somewhere(i dont know where exactly).

I tried setting in the XML view like this: it did not work

<items>

<core:Item id="aggregatedViewItems" key="{Key1}" text="{Text1}" templateShareable="false"/>

</items>

Can somebody help me with syntax how i can set templateShareable within/before this statement: var oView = that.getView().byId("aggregatedView").clone();

BR,
Venky.

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

6 Answers

Best Answer
Venkatesha N
Mar 01, 2017 at 05:52 AM
0

Hi Guys,

Thanks for your help.

I could fix it by setting templatesharable in the XML view itself.

Earlier the code was like this:

<ActionSelect id="aggregatedView" items="{ path: '/Zentity' }" maxWidth="20em" change="handleSwitchProcess" > <items>
<core:Item id="aggregatedViewItems" key="{Key1}" text="{text1}" />
</items>
</ActionSelect>

After fixing, it became:

<ActionSelect id="aggregatedView" items="{ path: '/Zentity', templateShareable:false }" maxWidth="20em" change="handleSwitchProcess" > <items>
<core:Item id="aggregatedViewItems" key="{Key1}" text="{text1}" />
</items>
</ActionSelect>

BR,
Venky.

Share
10 |10000 characters needed characters left characters exceeded
Venkatesha N
Mar 01, 2017 at 05:52 AM
1

Hi Guys,

Thanks for your help.

I could fix it by setting templatesharable in the XML view itself.

Earlier the code was like this:

<ActionSelect id="aggregatedView" items="{ path: '/Zentity' }" maxWidth="20em" change="handleSwitchProcess" > <items>
<core:Item id="aggregatedViewItems" key="{Key1}" text="{text1}" />
</items>
</ActionSelect>

After fixing, it became:

<ActionSelect id="aggregatedView" items="{ path: '/Zentity', templateShareable:false }" maxWidth="20em" change="handleSwitchProcess" > <items>
<core:Item id="aggregatedViewItems" key="{Key1}" text="{text1}" />
</items>
</ActionSelect>

BR,
Venky.

Share
10 |10000 characters needed characters left characters exceeded
Jun Wu Feb 28, 2017 at 06:10 AM
0

why you want to clone?

Share
10 |10000 characters needed characters left characters exceeded
Jun Wu Feb 28, 2017 at 06:11 AM
0

why you want to clone?

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Jun,

I wanted to clone due to the usage of template for binding and both problem and solution is explained here: https://archive.sap.com/discussions/thread/3542984

Any idea how i can set templatesharable before clone ?

BR,
Venky.

0
Veeraraghavan Narasimhan
Feb 28, 2017 at 05:42 PM
0

Hello Venky,

This is the jsdoc for binding aggregation .

As you would templateShareable is also a parameter in the binding. So your binding would be essentially be

oView.bindItems({ path: "/ZEntity", template: that.getView().byId("aggregatedViewItems"), filters: aFilters ,templateShareeable : true/false });               

I hope this helps.

Thanks and Regards,

Veera


Share
10 |10000 characters needed characters left characters exceeded
Veeraraghavan Narasimhan
Feb 28, 2017 at 05:50 PM
0

Hello Venky,

As attached here , this is jsdoc for aggregation binding

o your code would be

oView.bindItems({ path: "/ZEntity", template: that.getView().byId("aggregatedViewItems"), filters: aFilters ,templateShareable : true/false});

Hope this helps.

Thanks and Regards,

Veera

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Veera,

Thanks for the help.

I tried your suggestion, but the error is occuring at this statement itself:

var oView = that.getView().byId("aggregatedView").clone()

So, i need to set this 'templateShareable ' before i perform the clone() operation in the above statement, is it possible ?

Best Regards,
Venky.

0