I have a map with a marker, and i want to make the marker clicktable to show some basic info.
I am new to Sencha, and I need advice what should I implemante in listener function to get the same effect as i click on list item:
for example, this is my code of maprender function
var lat = 37.428607;
var lng = -122.169344;
var latLng = new google.maps.LatLng(lat, lng);
var marker = new google.maps.Marker({
position: latLng,
map: gmap,
draggable: false,
animation: google.maps.Animation.DROP,
title: 'cool'
});
var contentString = 'bla bla bla';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
google.maps.event.addListener(marker, 'click', function() {
/* here comes something that will make my detail list visible with the marker details*/
});
and i want to make it work in the same way as my function for “itemtap” which i use in my list… something like this:
onMyListItemTap: function(dataview, index, target, record, e, options) {
this.setActiveItem('detalji');this.down('#back').show();
this.down('#detalji').setData(record.data);
}
There is a great example on Github for Sencha Touch 1…I believe it’s called World Map. If you unzip that (the app is in one of the many folders) you can see a Google map wil multiple custom markers. This project is very useful for learning, as it not only shows custom map markers, but also popup overlays on a marker click.
I have yet to adapt it to Sencha Touch 2, but it shouldn’t be too difficult…here is some example code (after multiple markers have been added):
Also I think from what I understand about Sencha Touch 2, you would have to put a listener in your map controller (MyApp.map.controller file)….read up about the refs, as the refs ‘finds’ the marker(s) you have defined and adds a listener to the item.
If you have any progress please post your findings 🙂