AnsweredAssumed Answered

how communicate 2 custom dashlets

Question asked by carloszaragoza on Jul 28, 2016
Latest reply on Jul 29, 2016 by carloszaragoza

Angel Magana, Francesca Shiekh, Matt Marum

 

I have two custom dashlets, each has its own controller and each of them their own view(in a main dashboard). I want to execute a function of Dashlet 2 from Dashlet 1 and send an object.

 

One option is through events, but how can be implemented between custom events that can communicate dashlets?

 

One option is to loosely coupled components that is very common in object-oriented-programming, but in SugarCRM (Javascript / Backbone) how this is possible?

 

Regards

Dashlet Uno

initDashlet: function(options) {
  var eventoPersonalizado = {};
_.extend(eventoPersonalizado, Backbone.Events);
},
 disparaEvento: function () {

var objeto={};
objeto.id = "10000";
objeto.name = "SugarCRM";
this.context.trigger("eventoPersonalizado",objeto);
}

 

Dashlet Dos

initDashlet: function (options) {
  this.context.on('eventoPersonalizado', function (link) {
  console.log("Mensaje desde dashlet uno");
  console.log(link);
  }); 
 }

Outcomes