google maps - How can I get value of html element in sap ui5 xml view -


i'm trying google maps api example sap ui5 , following xml view:

    <html:input id="pac_input" class="controls" type="text"         placeholder="enter location" />     <html:div id="type_selector" class="controls">         <html:input type="radio" name="type" id="changetype-all" checked="checked" />         <html:label for="changetype_all">all</html:label>          <html:input type="radio" name="type" id="changetype_establishment" />         <html:label for="changetype_establishment">establishments</html:label>          <html:input type="radio" name="type" id="changetype_address" />         <html:label for="changetype_address">addresses</html:label>          <html:input type="radio" name="type" id="changetype_geocode" />         <html:label for="changetype_geocode">geocodes</html:label>     </html:div>     <html:div id="map-canvas" class="mymap"></html:div> 

i want "pac_input" input , "type_selector" div id in controller.js. whenever try this.getview().byid("map_canvas") says this.getview not function , guess happens because this window object , don't know how can elements. glad helps. here controller.js :

onafterrendering: function() {       if (!this.initialized) {           google.maps.event.adddomlistener(window, 'load', function(){             this.initialized = true;               util.common.geocoder = new google.maps.geocoder();               util.common.infowindow = new google.maps.infowindow();             var mapoptions = {                   center: new google.maps.latlng(-34.397, 150.644),                   zoom: 8,                   maptypeid: google.maps.maptypeid.roadmap               };               util.common.googlemap = new google.maps.map(this.getview().byid("map_canvas").getdomref(),                   mapoptions);              var input = this.getview().byid("pac_input");             var types = this.getview().byid("type_selector");             ... 

update 1: tried reach via sap.ui.getcore.byid() still undefined.

first made mistake @ <html:div id="map-canvas" class="mymap"></html:div>. id should map_canvas. , embeded div element variable @ common place , overwrite @ oninit(). works.

oninit : function () {     ...     util.common.map_canvas_div = this.getview().byid("map_canvas");     ... } onafterrendering: function() {     var input = util.common.pac_input_input;     ... } 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -