Search code examples
sapui5

How to read all the tiles in the Tile Container SAP UI5


<core:FragmentDefinition xmlns="sap.m"xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
    xmlns:html="http://www.w3.org/1999/xhtml" xmlns:l="sap.ui.layout">
 <Page id="tileInfo" showHeader="false" enableScrolling="true" > 
    <TileContainer    
      id="getTiles"

      tiles="{myModel1>TILECOLLECTION}">    
      <StandardTile 
        icon="{myModel1>icon}"  
        number="{myModel1>number}"  
        info="{myModel1>info}"
        infoState="{myModel1>infostate}" 
        title="{myModel1>title}" 
        numberUnit="{myModel1>numberunit}"
        press="handleTilePress"
        class="myGreen"    
        />   
        </TileContainer>   
       </Page> 
</core:FragmentDefinition>

I want to read each tile in the TileContainer in the view controller. Is it possible ?


Solution

  • in the controller:

    ...
    var oTileContainer = this.byId("getTiles");
    var aTiles = oTileContainer.getTiles();
    ...
    

    in the array aTiles are the tiles of the tiles aggregation of the tile container.