Select to view content in your preferred language

renaming sub-layer name in the layerlist widget

1235
3
05-22-2018 03:36 PM
AbhishekSharma1
Occasional Contributor

How can I update the sublayer name in the layer list widget?

during debugging in chrome developer console, while analyzing the element it was possible to rename and see the changes, however, couldn't find the relevant file in the downloaded code for WAB.

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Abhishek,

   Normally you would handle the renaming in your mxd that is used for that map service. I you have to do it in your code then you will have to do that through direct DOM manipulation. You need to find the DOM element using the id or some class and then change the innerHTML text (lines 9 and 10 in the showLayers function of the LayerList widget.js).

      showLayers: function() {
        // summary:
        //    create a LayerListView module used to draw layers list in browser.
        this.layerListView = new LayerListView({
          operLayerInfos: this.operLayerInfos,
          layerListWidget: this,
          config: this.config
        }).placeAt(this.layerListBody);

        var node = query(".layer-title-div-LOJIC_PublicSafety_Louisville_7908_0")[0]
        node.innerHTML = "Em Sirens";
      },
0 Kudos
KiroAndreev1
Emerging Contributor

Dear,

I have same problem.I would like to Localization Layers.I would like to change name from Macedonian into English language on Layer and SubLayer? 

I would like to use strings.js into nls folder.

How to solved this problem?

Best regard

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kiro,

  Then you would use code like I provided above to do the direct DOM manipulation. But you would make the query generic and loop through all the results.

0 Kudos