Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Clever_Anjos
Employee
Employee

Adding "Export Data" to DAR Template

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

Capturar.PNG

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?

7 Replies
Clever_Anjos
Employee
Employee
Author

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();

  }},

Anil_Babu_Samineni

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>

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Clever_Anjos
Employee
Employee
Author

No effect, is this function supposed to be called from where?

Anil_Babu_Samineni

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?

Capture.PNG

And, Expected result supposed to understand below

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Clever_Anjos
Employee
Employee
Author

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

psublue98
Creator
Creator

Hello Clever - were you able to get this working? I'm looking to achieve the same capability. Thanks!

psublue98
Creator
Creator

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>