Answer the question
In order to leave comments, you need to log in
How to correctly load ajax objectManager object data on click?
1. I create templates for balloons and icons.
2. While loading, I make an ajax request, where I get only id and coordinates.
3. By clicking on the object, I make another request, where I pass the id, I get the data.
4. setObjectOptions in the object creates options and distributes data there, and I already have everything in properties, so I have to pass properties to the object without wrappers:
objectManager.objects._objectsById[objectId].properties = {
address: json[objectId].name,
pic: json[objectId].photo
}
Answer the question
In order to leave comments, you need to log in
What a fine fellow I am, I will answer myself:
var object = objectManager.objects.getById(objectId);
object.properties = {
address: json[objectId].name,
pic: json[objectId].photo
}
var objectState = objectManager.getObjectState(objectId);
if (!objectState.isClustered) {
objectManager.objects.balloon.open(objectId);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question