Adding Bubbles Dynamically

3 posts, 0 answers
  1. Matt
    Matt avatar
    38 posts
    Member since:
    Nov 2014

    Posted 12 Jun 2015 Link to this post

    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. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 16 Jun 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Matt
    Matt avatar
    38 posts
    Member since:
    Nov 2014

    Posted 17 Jun 2015 in reply to T. Tsonev Link to this post

    That worked.  Thank you.
Back to Top