Adding layer to Attribute table widget

335
0
05-24-2021 05:07 AM
MartinPorteš
New Contributor III

Hi,

I would like to ask for help with a strange behaviour i noticed in my appliaction. I'm using WAB developer edition. The application is base on Web map which has no layers only backgroud. With a custom widget I am adding four layers. Also i am using default Attribute table widget.

First problem is that there is inconsistency with the result. Only one layer shows up. And almost every time a reload the application a different layer in in Attribute Table.

I'm trying to use this sample to send a layer to attribute table: https://developers.arcgis.com/web-appbuilder/sample-code/send-a-layer-to-attribute-table-widget.htm

At the moment I always recieve an error, that I'm unable to addLayerToTable. I found out that the problem is with the resource manager. Or to be exact the layer does not pass this check:

if (supportTableInfo.isSupportedLayer) {
    this._resourceManager.addLayerInfo(layerInfoSelf);
}

That is correct behaviour, because it is "ArcGISDynamicMapServiceLayer" and that does not fall in the LayerInfo.js check _getLayerTypesOfSupportTable.

I am confused why it is possible to manage to have correct layer in Attribute table (by just realoading), but I am unable to add the same layer from one widget to another using described sample.
 
To summarize my question. What should be the standard process to include layers in Attribute table when I have to add the layers dynamically (they must not be in the webmap beforehand)?
 
Thanks!
0 Kudos
0 Replies