Skip to Content
avatar image
Former Member

Unable to delete a Tile from tile container?

Hi all,

I have a 5 tiles in a view.In the Init method of the view i am checking a certain condition and want to delete the respective tile.

I am using the following code in init to delete

var main = sap.ui.getCore().byId("idUI_tilecontainer"); //Getting the container reference

var tile    = sap.ui.getCore().byId("idUI_tile2"); //Getting the tile reference

main.deleteTile(tile);

I am getting the following error in the console and the tile is not getting deleted.The error is referring to the standard controller TileContainer.js

tiledelete.JPG (20.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Oct 27, 2015 at 08:36 AM

    it should work... see screen recording below.

    http://i.imgur.com/f9YYSI3.gif

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 27, 2015 at 08:38 AM

    I see it is working fine - Tile Container

    If possible, can you share the code?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 27, 2015 at 08:54 AM

    Hi all,

    Following is my code

    View

    <core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:layout="sap.ui.layout"

                  controllerName="app.UI_DASHBOARD" xmlns:html="http://www.w3.org/1999/xhtml">

    <Shell id="shell_dash">

    <Page title="dash" showHeader="true" enableScrolling="false">

    <headerContent>

    <Button text="{i18n>HeaderBarHelp}" press="Handlehelp"></Button>

    </headerContent>

    <content>

    <TileContainer  id="maincontainer">

    <StandardTile

            id="tile1"

            icon="sap-icon://shipping-status"

            type="None"

            title="tile1

            infoState="None"

            press="Onpost"/>

    <StandardTile

            id="tile2"

            icon="sap-icon://shipping-status"

            type="None"

            title="tile2

            infoState="None"

            press="Onpost2"/>

    </TileContainer>

    </content>

    <footer>

    <Toolbar >

    <content >

    <layout:HorizontalLayout >

              <FlexBox

              alignItems="End"

              justifyContent="End">

              <items>

                 <Image src="images/slogo.png" height="40px">

                </Image>

              </items>

    </FlexBox>

    </layout:HorizontalLayout>

    </content>

    </Toolbar>

    </footer>

    </Page>

    </Shell>

    </core:View>

    Controller

    onInit: function() {

    var main = sap.ui.getCore().byId("idUI_tilecontainer"); //Getting the container reference

    var tile    = sap.ui.getCore().byId("idUI_tile2"); //Getting the tile reference

    main.deleteTile(tile);

    }

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 27, 2015 at 09:13 AM

    @Vijay:Thanks the code helps to delete the tile after its been displayed by manually clicking delete.But i want to delete before the tile is even displayed in init.

    @Vladimirs thanks the code is just a dummy code .

    @ all : I just checked that during the first time load of the application in init the deletetile method  is nor working and the tile container aggregation still holds 2 tiles.But if i navigate to different screen and then come back to this dashboard the init method is hit again and this deletetile works and tile container aggregation holds 1 tile but it is not reflected in the UI screen.The ui screen still shows 2 tile..

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 27, 2015 at 09:19 AM

    Hi Thivi,

    Will this help? JS Bin - Collaborative JavaScript Debugging

    Click Edit Button ( check this in Footer )

    Thanks,

    Karthik A

    Add comment
    10|10000 characters needed characters exceeded