2
votes

I'm trying to create a launchpad for a set of applications that we use here. One of my problems is that I need to add different tiles in a tile container (slide,custom,standard, etc) and what I think that may be a solution is use XML templating to do that. What I want to achieve is something like that:

<TileContainer id="tileList"
                allowAdd="true"
                tileDelete="onDelete"
                tiles="{path:'Atalhos>/' ,sorter:{path:'Atalhos>TileText',group:false}}">
                <template:if test="{path:'Atalhos>TileCode', operator:'EQ',value1:'teste1'}">
                    <template:then>
                        <core:Fragment fragmentName="pelissari.soficom.launchpad.view.StandardTile" type="XML"/>
                    </template:then>
                    <template:else>
                        <core:Fragment fragmentName="pelissari.soficom.launchpad.view.StandardTile" type="XML"/>
                    </template:else>                    
                </template:if>
            </TileContainer>

but the problem is that I'm having this error when I try to do that.

UIComponent-dbg.js:52 Uncaught Error: failed to load 'http://schemas/sap/com/sapui5/extension/sap/ui/core/template/1/if.js' from resources/http://schemas/sap/com/sapui5/extension/sap/ui/core/template/1/if.js: 404 - Not found

I know that I need to start the preprocessor to use preprocessing instructions but all the examples that I found makes me more confuse that I was before.

My project is based on the sapui5 tutorial "WalkThrough where I have a component that starts an app view configured in the manifest and this view is navigate to the launchpad view by routing configuration again in the mainfest. all the examples create a view in the component CreateComponent function or in some controller function that loads other view. I just need to start the preprocessor for the list of tiles that I load from the entity set "/TileSet".

1
SAP's samples suck on this suck completely. They never explain how you can use the preprocessor statements with ad-hoc views that are created by referencing them via <mvc:XMLView>. They only show this for views that have been created programmatically. The whole XML view concept sucks. Coming from React, this is a nightmare. - waldgeist

1 Answers

1
votes

I found another way to do what I want. Now I'm using factory function to create the tiles as I need.

tileFactory: function(sId, oContext) {
  var atalho = oContext.getProperty(oContext.sPath)
  var oUIControl = null;
  if (atalho.TileCode == 'teste2') {
    oUIControl = new sap.m.StandardTile(sId, {
      title: atalho.TileText
    });
    oUIControl.addStyleClass('tileSize3');
  } else {
    oUIControl = new sap.m.StandardTile(sId, {
      title: atalho.TileText
    });
    oUIControl.addStyleClass('tileSize1');
  }
  oUIControl.attachPress(this.onPress, this);
  oUIControl.addStyleClass('tile');

  return oUIControl;
}
<Page id="tileGroup" showHeader="true"
		content="{path:'Atalhos>/' ,sorter:{path:'Atalhos>TileOrder',group:false},factory:'.tileFactory'}">