cancel
Showing results for 
Search instead for 
Did you mean: 

Get Html id

0 Kudos

Hello Guys,

I have create SAPUI5 App and add iconTabBar like

var iconbar = new sap.m.IconTabBar({

                            expanded : "{device>/isNoPhone}",

                            select : function(){

                                oController.selectedTab();

                            },

                            items : [

             new sap.m.IconTabFilter({ // Icon

                            icon : "sap-icon://hint",

                            text : 'map',

                            key : i,

                           

                            content : [  new sap.ui.core.HTML(                                           

                                    {                                                   

                                        content : "<div id='map_canvas' style='width:800px; height: 320px;'></div>",

                                       // preferDOM : true, // boolean

                                     }

                                    ),

                            ]

                        // Detail off pertiqular tab

                        })

],

                        })

And add HTML using  sap.ui.core.HTML and but is my controller side i can't access or get my div id

selectedTab :function(){

        alert('selectedTab');

   var mapDiv = sap.ui.getCore().byId("map_canvas");

        //var mapDiv = this.getView().byId("map_canvas");

        alert(mapDiv);

        alert(document.getElementById("map_canvas") );

    },

but i get null. so please help me where i going wrong.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Please try fetching the div by id with

var mapDiv = $('map_canvas');

Greetz

Silvio

0 Kudos

Thanks Silvio it's working

Former Member
0 Kudos

The function sap.ui.getCore().byId("map_canvas") is searching for the attribute data-sap-ui="map_canvas" and not for the attribute id of the div.

Greetz

Silvio

PS: Please mark this thread as solved.