legend error

3679
2
03-04-2015 08:00 AM
BenFousek
Occasional Contributor III

I'm programmatically creating legend dijits. Map is loaded. Layer(s) loaded. The error occurs towards the end of _createLegend() method when it's try to set the _msg element innerHTML to NLS_noLegend string saying the _msg element is null. However, if I wrap in a 1 millisecond setTimeout it works fine. Why is this?

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Ben,

Would you be able to post the code you are working with?

0 Kudos
BenFousek
Occasional Contributor III

Jake Skinner​ it's a templated widget. I thought it might be a slight delay using put, but using an attach point as srcNodeRef has same behavior.

initLegend: function () {
    this.legend = new Legend({
        map: appModel.get('map'),
        layerInfos: [{
            layer: this.layerInfo.layer,
            title: this.layerInfo.layerToggleOptions.title || 'Layer Title'
        }]
    }, put(this.legendNode, 'div.layerControlLegendWidget'));
    this.legend.startup();
}
0 Kudos