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

Set Map Layer's DataSource Programmatically

1 Answer 212 Views
This is a migrated thread and some comments may be shown as answers.
Max
Top achievements
Rank 1
Max asked on 25 Jun 2018, 04:35 PM

I have a Kendo Vue Map with two layers: 1) a tile layer using OSM and 2) a bubble layer with a dataSource pointed to an api endpoint.  When I try to set the bubble layer's dataSource property to a component data property (this.mapPointDatasource) it does not work (see code below).  What am I missing?

 

...

data () {
      return {
        center: [39.5, -96],
        initialZoom: 4,
        mapPointDatasource: new kendo.data.DataSource({
          transport: {
            read: {
              url: 'http://<myJsonEndPoint>',
              dataType: 'json',
              cache: false
            }
          }
        }),
        layers: [
          {
            type: 'tile',
            urlTemplate: 'http://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png',
            subdomains: ['a', 'b', 'c']
          },
          {
            type: 'bubble',
            //dataSource: this.mapPointDatasource,  // <- DOES NOT WORK
            dataSource: {  // <-- WORKS
              transport: {
                read: {
                  url: 'http://<myJsonEndPoint>,
                  dataType: 'json',
                  cache: false
                }
              }
            }
          }
        ]
      }
    },

...

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 27 Jun 2018, 01:04 PM
Hi,

In cases when object form data needs to be referred in another property is recommended to use computed properties as for example it is explained in this forum thread.

Regards,
Plamen
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Max
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or