Closed OniQ closed 4 years ago
Hi, I'm looking at what I can do.
Version 1.0.10 which will arrive tomorrow will implement the click event on the cluster. To listen to it, you have to go to the onMarkerSelect (). Be careful, if you tap on a marker it returns a marker, if you tap on a cluster it returns an array of markers.
I tried and it works fine. Thank you!
However there is seems to be no userData from the original marker. My workaround is to get original marker by position. But it would be nice to have this data directly in this event.
Hi, now it should have userData in the marker array (android & iOS). (version : 1.0.11)
Hi, I've tested it and it seems to work only for strings. I can't access my assigned object.
By parsing it at the exit it does not work? Is this a javascript object?
I was not able to parse it, because I get object of type NSString. I use typescript and assign data to original marker like this:
const marker: Marker = new Marker();
marker.userData = {
id: m.id,
icon: m.iconCode
};
Ok, I'll look, is the iOS side more the problem?
I've tested only on iOS for now.
Ok i would look to see what's wrong.
The problem is that on the iOS part, apparently the marshalling ios is not done correctly, normally we should have a string [] but instead we have NSString[]. For now, to find a string done:
JSON.stringify ("" + marker.userData)
it is not ideal but at least you have the possibility of working on the data. I will see later for the problem.
Did this workaround help you?
No, it's not. Data from marker.userData is not a valid json. But I have my own workaround for now. It was enough to pass single id field.
Precisely I had taken your code
{ id: m.id, icon: m.iconCode }
and with this : JSON.stringify ("" + marker.userData)
do not forget the "" +
which allows to have a valid json after a parse.
I was able to access the json with the values id and icons
Hello. Can you make this. feature NS7 compatible? Now I get following error: NativeScript encountered a fatal error: Uncaught TypeError: Cannot read property 'collections' of undefined
Is would be great to have an event on cluster click. And have data of all markers it contains, if possible.