Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I´ve been using this great template DAR Mashup
Now I have the requirement to add a "Send to Excel" feature.
Steps I´ve done so far.
1) Changed the .js file to have a pointer to my object (there can be dozen of them into the page) (Maybe there´s a smarter way of doing this)
//app.getObject('QV1-01','pvsfTZ');
window.mashujObj['QV1-01']=app.getObject('QV1-01','pvsfTZ');
2) Changed the qliksense-card.html to exibit a button when maximized
<div class="card-actions">
<paper-icon-button icon="fullscreen" on-tap="fullscreenEnter" hidden$="{{fullscreen}}"></paper-icon-button>
<paper-icon-button icon="cloud-download" on-tap="download" hidden$="{{!fullscreen}}"></paper-icon-button>
<paper-icon-button icon="fullscreen-exit" on-tap="fullscreenExit" hidden$="{{!fullscreen}}"></paper-icon-button>
</div>
3) How it looks now
4) My current qliksense-card.html javascript
<script>
Polymer({
is: 'qliksense-card',
...
download: function(){
var d = this.getContentChildren();
if ( window.mashujObj[d[0].id] ) {
var t = window.mashujObj[d[0].id];
// have tried with t.exportData({download: true});
// have tried with var qTable = qlik.table(window.mashujObj[d[0].id]);
// qTable.exportData({download: true});
}
},
None of them works.
Any help?
Another unsucessfull try
,
download: function(){
var d = this.getContentChildren();
d = d[0];
if ( window.mashujObj[d.id] ) {
window.mashujObj[d.id].then(function(vis){
vis.exportData({download:true});
});
vis.Promise.resolve();
}},
How about adding this in your Java script?
<script>
Polymer({
is: 'qliksense-card',
...
download: function(){
var d = this.getContentChildren();
if ( window.mashujObj[d[0].id] ) {
var t = window.mashujObj[d[0].id];
}
},
support: function(){
exportdata: true
},
</script>
No effect, is this function supposed to be called from where?
In my extension, There is nothing concept called Export Data. So, I have implemented the same and it's working as expected. But, in your scenario there might be some thing mis routing using HTML and clubbing JavaScript?
And, Expected result supposed to understand below
Hi, thanks a lot, but you´re implementing an extension, i´m using a mashup I think they´re not the same usage, I don´t have a "right click" action, I have to implement as button
Hello Clever - were you able to get this working? I'm looking to achieve the same capability. Thanks!
Clever and others,
We were able to accomplish the download functionality by adding this to the .js file:
// Download function
$(document).ready(function() {
$(document).on('click', ".downloaddata", function(e) {
var downloaddiv = $(this).parent().parent().find('.qvobject')[0];
console.log(downloaddiv);
console.log('download data');
var objScope = angular.element(downloaddiv.children[0]).scope();
var objId = objScope.model.id;
app.getObject(objId).then(function(model) {
var table = qlik.table(model);
table.exportData({download: true});
});
});
});
and this to the qliksense-card.html:
<paper-icon-button src="./svg/download.svg" class="downloaddata" ></paper-icon-button>