Maps not updating with data update

Expected behavior

I am getting location of driver and show it on map. I need to update map as values update in the the database.

Actual behavior

Map is not updating. I need to refresh every time to see update location.

Hi @Uzair_Raza1, and welcome to our community :wave:,

We currently rely on HTTP REST to do the call to your admin backend, that’s why you need to refresh the page every time to get the new location. The data associated to the map are requested once thus you’ll need to refresh your page each time to get the new value of this record.

As far as I know, such a feature cannot be added in a summary/details, but could be achieved in the table view using custom code relying on socket & smart view. Documentation related to the smart view can be found here.

Another solution, that is not perfect but that would avoid to refresh the whole page, could be to implement a smart action to “update” the display of your record. Not that great since you would still have to do an action to refresh the display, but that could be a possible solution. Documentation about smart actions is available here

Still, I’ll push this as a suggestion on our product board, since your use case might interest other.

Let me know if that helps

1 Like

thank you for your quick reply.
I will go with second solution for now.



@jeffladiray I need to add smart action as you say but smart action show when I have to select at least one record. I need to show button without any selection.

one other way is to keep any one record selected but I can’t select record on map. Is there any solution you have?

Hello @Uzair_Raza1,

Smart actions can have 3 types:

  • bulk, meaning that the action will be applied to a selection of entries
  • single, indicating that the action can only be performed on one entry
  • global, is the type indicating that the smart action does not need a selection to be applied.

You can take a look at the documentation about smart actions to see how to declare a global smart action that can fit your usecase.

1 Like

I action button added successfully. but it is not updating my map. I am sending back data as follow:

      success: "Data updated",
      updated: true,
      refresh: true,

It needs to get updated data from database. I don’t know how many records are updated in DB so I will have to get all data.

help me. :pray:

Hello again @Uzair_Raza1,

I’m not sure in which context you are displaying this map.

Did you create a new smart view, following this example, or are you in the context of a details/summary view?

In the context of a smart view

You can periodically call this.fetchRecords() from your code, and you smart view should automatically be updated at the rate you decided.

In this case, you don’t need a smart action.

In the context of a details or summary view

In this case, you need to define your smart action with type:'single', and make sure to return the record from your smart action.

1 Like