jeudi 19 juillet 2018

Need to call the Action inside the function

I'm new to the ember and doing the action for while click on the download icon in the folder type. It have to download as zip. For that they wrote already in the java and created a service for that as like below:

Core.Action({
    id: 'core:downloadZip',
    invoke: function (context) {
        console.log(context);
        var mos = Ember.get(context, 'managedObjects') || [Ember.get(context, 'managedObject')];

    var moIdResult = [];
    var moArray ='';
    mos.forEach(function (mo) {
        moArray = moIdResult.push(mo.get('finalManagedObject.id'));
      });
      Core.services({
        download:true,
          type: 'get',
          service: 'content/zip',
          iframe: true,
          data: {
            coreId: moIdResult
          }
      }).done(function (response) {
          console.log(response);
      }.bind(this));
  },isValid: rules.all(
          rules.any(rules.isMO, rules.areMOs),
          rules.not(rules.isHome)
      )
});

In that service: 'content/zip' doing that action as download as zip from the java file. But when I'm calling the above code in the same file as like below:

           click: function(e) {
                  var type = this.get('content.kind');
                  if(type == 'Folder'){
                      Core.Action('core:downloadZip', context);
                  }
           }

When I'm calling as like above, its not taking and moreover not even showing any error. Cany anybody please provide me suggestion on this. I'm new to the Ember and I'm using ember 1.4.0 version. Thanks in advance




Aucun commentaire:

Enregistrer un commentaire