3

We are using Qlik sense + geo analytic for one of our web application. Please look into below image Screen shot of my qlik sense map

In above image, you can see different color pins. Each pin has its own information. Qlik sense doesn't provide any click event for these pins, qlik sense provides only mouse over event. But our client asked me to show some popup on click event of pin rather than mouse over.

I have done this through JavaScript document.activeElement but that code is only running in Chrome.

Please find the below code:

var currentELement = document.activeElement;

currentELement.addEventListener("click",function (event) {
    var el = event.target || event.srcElement;
    var outerHtml = el.outerHTML;

    if(outerHtml!=undefined && outerHtml!="" && outerHtml.indexOf("<canvas")!=-1)
    {
        //It will dsiplay popup
        document.getElementById("LP").style.display="block"; 
        document.getElementById("CT").style.display="none"; 
    }
});

NOTE: I have googled a lot and came to know that might prior to IE-9 doesn't understand addEventListener, so we have to use attachEvent.

Also tried following code:

function bindEvent(elmnt, eventName, eventHandler) {
    if (elmnt.addEventListener){
        elmnt.addEventListener(eventName, eventHandler, false); 
    } 
    else if (el.attachEvent){
        elmnt.attachEvent(eventName, eventHandler);
    }
}

var currentELement = document.activeElement;

bindEvent(currentELement, "click", function (event) {
    var el = event.target || event.srcElement;
    var outerHtml = el.outerHTML;

    if(outerHtml!=undefined && outerHtml!="" && outerHtml.indexOf("<canvas")!=-1)
    {
        document.getElementById("LP").style.display="block"; 
        document.getElementById("CT").style.display="none"; 
    }
});

Suggest me the alternate solution or correct me if I am doing anything wrong.

halfer
  • 19,824
  • 17
  • 99
  • 186
Dilip Solanki
  • 111
  • 1
  • 2
  • 8
  • The event names are different in the legacy IE event model, should be `elmnt.attachEvent('on'+eventName, eventHandler);`, though that should not be a problem in IE11. What actually is your problem with code when run in IE11? – Teemu Aug 21 '17 at 12:15
  • Notice also, that you haven't defined `el` in `bindEvent` function, might be a typo in the post only? – Teemu Aug 21 '17 at 12:35

0 Answers0