This is a migrated thread and some comments may be shown as answers.

Adding Bubbles Dynamically

2 Answers 116 Views
Map
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 12 Jun 2015, 03:06 PM

I'm able to show bubbles if the datasource contains them at the time the map is created, but I want to be able to add them dynamically.

To add markers dynamically I do map.markers.add(marker);

To add non-bubble shapes dynamically I define my shapes layer like this:

 

{
                type: "shape",
                dataSource: shapes,
                style: { fill: { opacity: 1 }, stroke: { width: 1, color: "#88f" } }
            },

with shapes defined like this:

var shapes = new kendo.data.DataSource({type: "geojson"});
Then when I do shapes.add(shape); it automatically adds it to the map.

According to this thread the only types of fields you can define in a custom datasource are "string", "number", "boolean" and "date".  Unfortunately the bubble layer's location field is looking for a Lat Long, so that makes it so I can't use a kendo datasource object.

Is there a way to make this work?

 

 

 

2 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 16 Jun 2015, 11:50 AM
Hi,

You can omit the type for the field, data source operations will still work fine.

The type is used to provide default values and conversion methods. Unrecognized values will be dropped.

I hope this helps.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Matt
Top achievements
Rank 1
answered on 17 Jun 2015, 02:13 PM
That worked.  Thank you.
Tags
Map
Asked by
Matt
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Matt
Top achievements
Rank 1
Share this question
or