I have a map where I have markers that are shipments (individual markers) and loads which are a collection of markers joined by lines. I can right click on a marker that is part of a load and get a menu with the option to remove shipment from load. In the mode for the remove shipment from the load I am accessing the map layers. In the removal process, I have to rebuild the map items. I rebuild the map layers by getting the datasource of the necessary layer, setting the data for the datasource to an empty array ([]) and then pushing in the new data to the datasource.
I have 2 shape layers and 1 marker layer.
The first time I right click and remove a shipment from a load it works perfectly. I try it again ( the context menu shows and goes into the called function) and get the following error:
TypeError: Cannot read property 'layer' of undefined
In the called function,
e.target = span.k-marker.k-marker-pinpink.removeFromShipmentContextMenu
$(e.target) finds the element
But $(e.target).data("kendoMarker") returns undefined.
What am I missing in reload of the map objects?
Thanks
Jason