I am currently working on developing a JS extension for Qlik Sense and my goal is to create an extract button similar to the one provided in the documentation.
I have two options to achieve this - one using AngularJS
and the other using jQuery + JS.
First Approach: I attempted to use AngularJS:
html = "<div class='exportArea' style='float:right'><div id='exportText'></div><button ng-click=\"table.exportData({download:true})\">Create Excel file</button></div>" + html;
Unfortunately, I did not succeed with this approach.
Second Approach:
Next, I tried using $element.find.
$element.find("#exportButton").on("qv-activate", function(){}
However, I was unsure of how to proceed with calling the export function afterwards.
var qTable = qlik.table(this);
var $exportButton = $( document.createElement('button'));
$exportButton.html('Export');
$exportButton.bind('click', function ( ) {
qTable.exportData({download: true});
});
$element.append($exportButton);
In summary, my ultimate goal is to integrate the code from the documentation using the tag id='exportButton' within the existing structure.
html = "<div class='exportArea' style='float:right'><div id='exportText'></div><button id='exportButton'>Create Excel file</button></div>" + html;
Thank you for any assistance in advance!