cancel
Showing results for 
Search instead for 
Did you mean: 

XML templating in fragment error

former_member214867
Participant
0 Kudos

Hi experts.

I am trying to use xml template in fragment but it does not work and i am getting error below.

Uncaught Error: failed to load 'http://schemas/sap/com/sapui5/extension/sap/ui/core/template/1/repeat.js' from ../../resources/http://schemas/sap/com/sapui5/extension/sap/ui/core/template/1/repeat.js: 404 -

In fragment i use namespace

xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"

How to resolve this issue ?

junwu
Active Contributor
0 Kudos

can you change it to view and have a try?

former_member214867
Participant
0 Kudos

Hi Jun.

I changed fragment to view but it does not work too.

If i add this code in view:

<template:repeat list="{JSONTabCols>/results}" val="cols">
<Label text="{cols>name}"/>
</template:repeat>

The error remains the same (

Uncaught Error: failed to load 'http://schemas/sap/com/sapui5/extension/sap/ui/core/template/1/repeat.js'

)

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

you use the template as view directly? you have to process the template view before it can be used as target.

Restriction

XML templating is not directly supported with routing, that is, there is no way to declare that the XML Preprocessor should run on the target view of a route. Instead, you should define a JavaScript view as the route's target and use that view'screateContentmethod to create an XML view with templating. In case you need access to models (which are not yet available in that hook), you should return some dummy content first (for instance sap.m.HBox), register to the view's modelContextChange event and create the inner view in that event's handler, finally adding it to the dummy content.

JavaScript Target View For Routing

sap.ui.jsview("some.package.RouteTargetView",{
    createContent :function(){return sap.ui.view({
            async :true,
            preprocessors :{
                xml :{// ...}},
            type : sap.ui.core.mvc.ViewType.XML,
            viewName :"some.package.TemplateView"});}});
former_member214867
Participant
0 Kudos

Thanks Jun !!!

Answers (0)