Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Keto
Partner - Contributor III
Partner - Contributor III

Button Extension Action

Hello everyone,

I would like to be able to call a JS function thanks to a button of a qliksense visualization that i created. (My goal is to export the whole of the current page in pdf format)
When I am locally it works fine but using a QlikSense extension nothing happens ...

Do you have any ideas or do you see something wrong ?

here is a preview of the code and architecture :

 

 

define(["//html2canvas.hertzen.com/dist/html2canvas.min.js", "//code.jquery.com/jquery-3.6.0.min.js", "//cdnjs.cloudflare.com/ajax/libs/dom-to-image/2.6.0/dom-to-image.min.js", "//cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.0/jspdf.umd.min.js"], () => {
    $('#export-qs').click(function() {
        domtoimage.toPng(document.getElementById('grid-wrap'))
            .then(function(blob) {
                var pdf = new jsPDF('l', 'pt', [$('#grid-wrap').width(), $('#grid-wrap').height()]);

                pdf.addImage(blob, 'PNG', 0, 0, $('#grid-wrap').width(), $('#grid-wrap').height());
                pdf.save("feuille_qliksense.pdf");
            });
    });

    return {
        paint: function($element, layout) {
            var bouton = '<button id="export-qs">Export Feuille</button>';
            $element.html(bouton);
        }
    }
})

 

 

 

 

Keto_0-1640774485648.pngKeto_1-1640774510386.png

 

thanks in advance 🙂

I promise i try my best, motivation is the key !
Labels (4)
1 Reply
Keto
Partner - Contributor III
Partner - Contributor III
Author

It is impossible to call a JS function when clicking on a button 😞 ?

I promise i try my best, motivation is the key !