0

So I have 2 Table widgets and a Maps Widget on the Thingsboard, when I click an item in the list table, I want the maps to auto zoom to the marker in the second Maps Widget on the Thingsboard?

How to auto zoom on Maps Thingsboard with type openstreetmaps?

4
  • First of all you need to find how to change zoom in Leaflet JS library. TB map widget uses it under the hood. Here is how to access to Leaflet map object: widgetContext.map.map.map
    – devaskim
    Commented Dec 16, 2022 at 11:26
  • I did it but when I console is undefined?
    – zidniryi
    Commented Dec 19, 2022 at 4:16
  • @devaskim can you enlight me? Thanks
    – zidniryi
    Commented Dec 19, 2022 at 4:16
  • Strange, try this widgetContext.mapInstance.map.map
    – devaskim
    Commented Dec 19, 2022 at 8:42

1 Answer 1

0

I would make two dashboards.

First one is the one you already have, so the map of all Devices/Assets and Table. On click of some table row set and action to navigate to new dashboard state.

Second dashboard is the one that opens up upon that previous action, and also has alias that will take dashboard state and point to clicked Device/Asset. With that, you can have a map that will show only that clicked Device/Asset and therefor zoom onto it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.