Problem with LayerList widget in Web AppBuilder

4676
9
Jump to solution
08-04-2015 10:32 AM
DavidYarnell
New Contributor III

I have an mxd that I enable to allow assignment of unique numeric IDs for map service publishing. This way when I add a new layer to the mxd and re-publish my indexing stay the same and my queries in the query widget will not have to be changed every time I add a layer to the service. When I do this I finding some issues with they LayerList widget where either the layers don't appear in the widget list or they appear but they are not checked appropriately for the default visibility. Has anyone else experienced an issue with allowing assignment of unique numeric IDs for map service publishing?

0 Kudos
1 Solution

Accepted Solutions
XiaodongWang
Esri Contributor

Sorry for any inconvenience caused, this is a bug of WAB and had been fixed by online3.10 (released on Nov 17),

BUG-000090820 The Layer List widget in Web AppBuilder for ArcGIS fails to list the layers for an ArcGIS Server service containing a group layer with a custom numeric ID

Developer Edition fix it in v1.3 (will release in this month).

View solution in original post

9 Replies
MichaelVolz
Esteemed Contributor

At ArcGIS Server v3.0 immutable layer ids are available.  This means you can assign an ID to a layer and any new layers will get a higher ID, but the IDs already assigned will not be changed even if you add a layer above existing layers.  I think this should help out to make your workflow easier.

0 Kudos
MegPeterson
New Contributor III

Hi Michael -

Where do you assign the id's? - Thanks, Meg

0 Kudos
RyanStrain
New Contributor III

I'm experiencing this same issue. Some groups within my layerlist don't expand. Other layers don't become visible when checked and throw  "Cannot read property 'parentLayerId' of undefined". The error exists in the jimu.js/LayerInfos/LayerInfoForDefaultDynamic.js:100. It's too bad because I assumed ESRI added this functionality in it's REST endpoint so developers wouldn't have to reconfigure queries, and other functionality each time any layer changes to mainly support Web AppBuilder development. Does anyone know how to resolve this issue? I can't even use the assignment of unique numeric IDS, it's not compatible with WAB. Thanks.

0 Kudos
MaxMcCosham
New Contributor III

I'm having the same problems. Trying to get this to work so I don't have to re-assign layer IDs in various places in WAB code.

The error I'm getting occurs at line 100 in LayerInfoForDefaultDynamic.js :

if (objLayerInfos[currentId].parentLayerId === -1) {

When I reorder the layers in a map service, the value of currentId matches the unique numeric ID I have set in the MXD before publishing. If I have 10 layers, for example, and add an 11th layer between layers 3 and 4, the value of currentId is 11. In the objLayerInfos array, however, index 11 still refers to the last layer in the map service (which would have the unique sub layer id 10) instead of the 4th layer in the map service. I think this is where the problem is happening, but I'm not sure how it could be resolved, or if similar problems are being caused elsewhere.

0 Kudos
XiaodongWang
Esri Contributor

Sorry for any inconvenience caused, this is a bug of WAB and had been fixed by online3.10 (released on Nov 17),

BUG-000090820 The Layer List widget in Web AppBuilder for ArcGIS fails to list the layers for an ArcGIS Server service containing a group layer with a custom numeric ID

Developer Edition fix it in v1.3 (will release in this month).

MaxMcCosham
New Contributor III

Thanks for the update! I would like to implement this fix in an app built using WAB 1.2, as I'm not yet ready to update the entire app to WAB 1.3. Would replacing the jimu.js/LayerInfos folder in v1.2 with the updated code from v1.3 cause problems?

Thanks,

DavidMann1
New Contributor III

Thanks for the suggestion, Max.  I tried this and it appears to have fixed the behavior of one layer in particular that I was having issues with and hadn't yet reset the layerIDs. 

Anybody else have positive/negative experience updating particular pieces of their apps from the 1.3 release to take advantage of bug fixes without restarting their apps from scratch with 1.3?

0 Kudos
MaxMcCosham
New Contributor III

I have been testing this as well and it seems to be working with services with custom layer IDs that are not in order. I'm not seeing any problems yet, but I would still be interested in finding out if replacing the LayerInfos can cause problems.

0 Kudos
DanNorman
Occasional Contributor

Just to second Max, I would also like to know if there is a way to implement a 1.2 fix as I'm not yet ready to update the entire app to WAB DE 1.3

We would be extremely greatful!!!!

thanks