Nav,
Here is the whole working 2.2 addLayerNode function in case you missed something:
addLayerNode: function(layerInfo, level, toTableNode) {
var layerTrNode = domConstruct.create('tr', {
'class': 'jimu-widget-row layer-row ' +
( false ? 'jimu-widget-row-selected' : ''),
'layerTrNodeId': layerInfo.id
}, toTableNode),
layerTdNode, ckSelectDiv, ckSelect, imageNoLegendDiv,
imageNoLegendNode, popupMenuNode, i, imageShowLegendDiv, popupMenu, divLabel;
layerTdNode = domConstruct.create('td', {
'class': 'col col1'
}, layerTrNode);
for (i = 0; i < level; i++) {
domConstruct.create('div', {
'class': 'begin-blank-div jimu-float-leading',
'innerHTML': ''
}, layerTdNode);
}
imageShowLegendDiv = domConstruct.create('div', {
'class': 'showLegend-div jimu-float-leading',
'imageShowLegendDivId': layerInfo.id
}, layerTdNode);
ckSelectDiv = domConstruct.create('div', {
'class': 'div-select jimu-float-leading'
}, layerTdNode);
ckSelect = new CheckBox({
checked: layerInfo.isVisible(),
'class': "visible-checkbox-" + layerInfo.id
});
domConstruct.place(ckSelect.domNode, ckSelectDiv);
imageNoLegendDiv = domConstruct.create('div', {
'class': 'noLegend-div jimu-float-leading'
}, layerTdNode);
var imageName;
if (layerInfo.isTable) {
imageName = 'images/table.png';
} else {
imageName = 'images/noLegend.png';
}
imageNoLegendNode = domConstruct.create('img', {
'class': 'noLegend-image',
'src': this.layerListWidget.folderUrl + imageName,
'alt': 'l'
}, imageNoLegendDiv);
if (layerInfo.noLegend || layerInfo.isTable) {
domStyle.set(imageShowLegendDiv, 'display', 'none');
domStyle.set(ckSelectDiv, 'display', 'none');
domStyle.set(imageNoLegendDiv, 'display', 'block');
}
domStyle.set(layerTdNode, 'width', level * 12 + 40 + 'px');
var layerTitleTdNode = domConstruct.create('td', {
'class': 'col col2'
}, layerTrNode);
var grayedTitleClass = '';
try {
if (!layerInfo.isInScale()) {
grayedTitleClass = 'grayed-title';
}
} catch (err) {
console.warn(err.message);
}
var layerTitleDivIdClass = 'layer-title-div-' + layerInfo.id;
divLabel = domConstruct.create('div', {
'innerHTML': layerInfo.title,
'class':layerTitleDivIdClass + ' div-content jimu-float-leading ' + grayedTitleClass
}, layerTitleTdNode);
layerTdNode = domConstruct.create('td', {
'class': 'col col3'
}, layerTrNode);
popupMenuNode = domConstruct.create('div', {
'class': 'layers-list-popupMenu-div'
}, layerTdNode);
popupMenu = new PopupMenu({
_layerInfo: layerInfo,
box: this.layerListWidget.domNode.parentNode,
popupMenuNode: popupMenuNode,
layerListWidget: this.layerListWidget,
_config: this.config
}).placeAt(popupMenuNode);
this.own(on(popupMenu,
'onMenuClick',
lang.hitch(this, this._onPopupMenuItemClick, layerInfo, popupMenu)));
var trNode = domConstruct.create('tr', {
'class': '',
'layerContentTrNodeId': layerInfo.id
}, toTableNode);
var tdNode = domConstruct.create('td', {
'class': '',
'colspan': '3'
}, trNode);
var tableNode = domConstruct.create('table', {
'class': 'layer-sub-node',
'subNodeId': layerInfo.id
}, tdNode);
this.own(on(layerTitleTdNode,
'click',
lang.hitch(this,
this._onRowTrClick,
layerInfo,
imageShowLegendDiv,
layerTrNode,
tableNode)));
setTimeout(
lang.hitch(this,
this._onRowTrClick,
layerInfo,
imageShowLegendDiv,
layerTrNode,
tableNode),
300);
this.own(on(imageShowLegendDiv,
'click',
lang.hitch(this,
this._onRowTrClick,
layerInfo,
imageShowLegendDiv,
layerTrNode,
tableNode)));
this.own(on(layerTrNode,
'mouseover',
lang.hitch(this, this._onLayerNodeMouseover, layerTrNode, popupMenu)));
this.own(on(layerTrNode,
'mouseout',
lang.hitch(this, this._onLayerNodeMouseout, layerTrNode, popupMenu)));
this.own(on(ckSelect.domNode, 'click', lang.hitch(this,
this._onCkSelectNodeClick,
layerInfo,
ckSelect)));
this.own(on(popupMenuNode, 'click', lang.hitch(this,
this._onPopupMenuClick,
layerInfo,
popupMenu,
layerTrNode)));
return {
currentNode: layerTrNode,
subNode: tableNode
};
},