We have been using the EnhancedQuery widget in WAB 2.5 and it works fine. Now we are trying it in WAB 2.12 but there is an error.
The EnhancedQuery widget executes a QueryTask and then calls publishData to send the query results to the AttributeTable. In 2.5, the query executes, the query layer is added to the LayerList and map, and the AT opens and displays the query results table. In 2.12, everything is fine until the AT opens and it says "No tables available to display". In the console there is this error: TypeError: Cannot read property 'getLayerObject' of undefined.
Strangely, when I open the LayerList and click the three dots for the query result and select "View in Attribute Table", the AT opens and displays the query results fine. So the problem is when the AT is called from the EnhancedQuery widget.
Even though the query layer is in the LayerList and on the map it is not in ResourceManager layerInfosFromMap (or at least it's not there when the AT goes looking for it) so when the AT function addLayerToTable calls the ResourceManager getLayerInfoById function to get the query layer from layerInfosFromMap, the query result is not in layerInfosFromMap.
I don't know what this means but I logged layerInfosFromMap.length to the console and it is 63 but when I logged the entire layerInfosFromMap object it says its length is 64 and the query layer is at the bottom. So maybe it is in there?
Does anyone have any ideas of why there might be a problem adding a query layer to ResourceManager layerInfosFromMap?