I'm trying to modify LayerListView.js of the webappbuilder layer list widget, so the image of the noLegend-image class will change based on the layer.
To accomplish this I tried adding the else-if to the dojo query below. Based on the HTML/CSS in the attachment, how should the else-if be filled to populate the img class based on the tr class value. Maybe this is the wrong approach but it seems the most obvious.
Dojo Query:
var imageName:
if (layerInfo.isTable){
imageName = 'images/table.png';
}
else if query () == 'yourLayer' {
imageName = 'images/yourLayer.png';
}
else {
imageName = 'imageName = 'images/noLegend.png';
}
Solved! Go to Solution.
Tim,
Unless I am misinterpreting the code and your intent then what you are asking is not doable. You are asking for the proper code to query an attribute of a element that is yet to be created and added to the DOM. I think this is what you are after:
var imageName; if (layerInfo.isTable) { imageName = 'images/table.png'; } else if (layerInfo.id === 'yourlayer'){ imageName = 'images/yourLayer.png'; } else { imageName = 'images/noLegend.png'; }
Tim,
Unless I am misinterpreting the code and your intent then what you are asking is not doable. You are asking for the proper code to query an attribute of a element that is yet to be created and added to the DOM. I think this is what you are after:
var imageName; if (layerInfo.isTable) { imageName = 'images/table.png'; } else if (layerInfo.id === 'yourlayer'){ imageName = 'images/yourLayer.png'; } else { imageName = 'images/noLegend.png'; }
That was it, thanks!