Select to view content in your preferred language

After grouping layers in the layerlist widget the legend widget does not work

852
1
Jump to solution
02-21-2017 11:33 AM
GilbertoMatos
Frequent Contributor

Hello!

I was able to group my layers in the layerlist widget as I needed it, but the problem is that now, for example, my legend widget always displays "No legends".

Running a debug, I realized that the operational layers of the map obviously are no longer in the standard object, but in the clustered one. However, I tried to modify the following lines in the legend widget, but I did not succeed.

...

this._jimuLayerInfos = LayerInfos.getInstanceSync();  //This line
var legendParams =
{
        arrangement: this.config.legend.arrangement,
        autoUpdate: this.config.legend.autoUpdate,
        respectCurrentMapScale: this.config.legend.respectCurrentMapScale,
        //respectVisibility: false,
        map: this.map,
        layerInfos: this._getLayerInfosParam() ////This line
};

...

For grouping the layers, finally, I used the tip contained in the link below.

https://community.esri.com/thread/174943

Thanks for the help.
Gilberto.

0 Kudos
1 Solution

Accepted Solutions
GilbertoMatos
Frequent Contributor

Hello!

I found the solution. It was only necessary to change the code snippet below in the file "... \ widgets \ Legend \ Utils.js".

...

var getLayerInfosParamFromCurrentMap = function()
{
        var layerInfosParam = [];
        var jimuLayerInfos = LayerInfos.getInstanceSync();
        var jimuLayerInfoArray = jimuLayerInfos._layerInfos; //jimuLayerInfos.getLayerInfoArray();

        array.forEach
        (

                ...

View solution in original post

0 Kudos
1 Reply
GilbertoMatos
Frequent Contributor

Hello!

I found the solution. It was only necessary to change the code snippet below in the file "... \ widgets \ Legend \ Utils.js".

...

var getLayerInfosParamFromCurrentMap = function()
{
        var layerInfosParam = [];
        var jimuLayerInfos = LayerInfos.getInstanceSync();
        var jimuLayerInfoArray = jimuLayerInfos._layerInfos; //jimuLayerInfos.getLayerInfoArray();

        array.forEach
        (

                ...

0 Kudos