Auto-refresh attribute tables when the associated layer is set to a refresh interval

03-23-2015 09:31 AM
New Contributor II

Just a feature request to have the attribute tables auto-refresh when their associated tables are set to a refresh interval.

A specific use case is a police/fire vehicle and call tracker where new calls and vehicles are updated on the map via a refresh interval on their layer.  Currently, only the map updates, not the associated attribute table.

Tags (1)
2 Replies
Occasional Contributor III

Jason Klrkland​,

If you go into the \widgets\AttributeTable\Widget.js file and add

setInterval(lang.hitch(this, this.onRefreshButton),3000); // setInterval(expression,milliseconds);

I added it right after the refresh button is called around line 1492, but I am sure it could be called other places as well. It would look something like this.

        this.refreshButton = new Button({
          label: this.nls.refresh,
          showLabel: true,
          iconClass: "esriAttributeTableRefreshImage",
          onClick: lang.hitch(this, this.onRefreshButton)
        setInterval(lang.hitch(this, this.onRefreshButton),3000); // setInterval(expression,milliseconds);

This calls the refresh of the attribute table every 3 seconds. I did notice that if the attribute table has lots of features or tables to load it takes a little longer. Also this will continue to refresh the attribute table even when it is closed.

This would be great to have in the AGOL version too.

With a little more work I am sure you could add it as a button to toggle the refresh option.


Occasional Contributor III

Also if you did not want to see the little image flashing every time it reloads the just add this in the onRefreshButton function


like this around line 1555

      onRefreshButton: function() {
        if (this.layersIndex > -1) {
          if (this.grids[this.layersIndex]) {
          if (this.graphicsLayers[this.layersIndex]) {

          if (this.config.layerInfos[this.layersIndex]) {
            this.config.layerInfos[this.layersIndex].loaded = false;
            this.startQuery(this.layersIndex, this.config.layerInfos[this.layersIndex].extent);
        this.showRefreshing(false); //added this


0 Kudos