on 02-09-2017 11:12 AM
Hi everyone,
I need to attach a 'click' event to geomap control, on press of a button. I have used the attachClick function in geomap control. Even after attaching the event, the target function is not getting executed.
ie,
In the given snippet, even after attaching the click-event "onClickMap", the function is not invoked when click event occurs on geomap.
In View :-
<vbm:GeoMap id="map">...</vbm:GeoMap>
.
.
.
.
<Button text="Attach Click" press="onAddCordinates"></Button>
In controller :-
onClickMap: function(oEvent) {
var position = oEvent.getParameter("pos");
console.log(position);
}
onAddCordinates: function(evnt) {
this.getView().byId("map").attachClick(this.onClickMap);
}
I solved the issue with an alternate logic. The attachClick function didn't work. So I defined the event in click event in the geomap control.
In View :-
<vbm:GeoMap id="map" click="onClickMap">...</vbm:GeoMap>
.
.
.
.
<Button id="addBtn" text="Attach Click" press="onAddCordinates"></Button>
In controller :-
onClickMap: function(oEvent) {<br>if(!this.getView().byId("addBtn").getEnabled()){
var position = oEvent.getParameter("pos");
console.log(position);
}
}
onAddCordinates: function(evnt) {
evnt.getSource().setEnabled(false);
}
Since I had to disable and enable the button for my use case, I used that property of the button to enable the click-event function logic.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.