Skip to content

Instantly share code, notes, and snippets.

@dimik
Last active May 6, 2017 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimik/7715fdba2db6da9a3615da598fdae787 to your computer and use it in GitHub Desktop.
Save dimik/7715fdba2db6da9a3615da598fdae787 to your computer and use it in GitHub Desktop.
cluster balloon layout
var MyClusterBalloonItemContentLayout = ymaps.templateLayoutFactory.createClass([
'<a href="/WebApp/tasks/editTask?id={{ properties.taskId }}" title="{{ properties.title }}" class="edit_btn">',
'<span class="glyphicon glyphicon-edit map_btn edit_map_btn"></span>',
'</a>'
].join(''), {
build: function() {
MyClusterBalloonItemContentLayout.superclass.build.call(this);
jQuery('.edit_btn', this.getParentElement()).on('click', function(e) {
...
})
}
});
var myClusterer = new ymaps.Clusterer({
clusterBalloonItemContentLayout: MyClusterBalloonItemContentLayout,
});
myMap.geoObjects.add(myClusterer);
for(...) {
myClusterer.add(new ymaps.GeoObject({
geometry: {
type: "Point",
coordinates: [addresses[i].log, addresses[i].lat]
},
properties: {
taskId: tasksNotDone[i].id,
title: "Редактировать задание",
}
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment