add innerHTML within title of popuptemplate (arcgis-js 4.xx)

260
0
07-09-2020 09:29 AM
CamCode
New Contributor III

I have tried it stand alone like this:

myLayer.popupTemplate = { <---  have also tried defining this as popupShake       title: function(feature) {          let spl = document.createElement("span");          spl.className = "name_plc";          spl.innerHTML = "<span class='name_plc'></span>";           return spl;      }    };

I have also tried it inline within the popuptemplate call (such as the content section, but title will not run even though documentation states it accepts strings and OR functions).

i.e.

         let popupShake = {            outFields: ["*"],           "title": function (feature){ <------------- breaks popup, but content below works                 let spl = document.createElement("span");                spl.className = "name_plc";                dlv.innerHTML = "<span class='name_plc'></span>";                 return spl;           },           "content": function (feature){             let name_plc;             let dlv = document.createElement("div");             dlv.className = "popd";             dlv.innerHTML = `<b><span class='name_plc'></span></b><br>ID: <span class="ida">${feature.graphic.attributes.id}</span><br> URL: <a href="${feature.graphic.attributes.url}" target="_blank">View</a> <br> Updated: ${feature.graphic.attributes.updated} <br>Grid_value: ${feature.graphic.attributes.grid_value}<br> Event Time: ${feature.graphic.attributes.eventTime}`;                            setTimeout(() => {                getName();             }, 20);             ................
Tags (1)
0 Kudos
0 Replies