1

I am trying to implement a custom dialog like the one describe HERE or HERE

In the js file I fdefined the modal's view as

var CustomDialog = require('./customModal')

var DialogModel = require('./MyModel') However, my DialogModel requires as parameter in its activate method. The route for the MyModel is defined to take a parameter and its activate method is defined as

function activate(routedata){
....
}

To open the dialog, I have

 var routedata = 90;
 this.dialog = new CustomDialog('My title', new DialogModel());
 this.dialog.show()

How do I pass this route data to the path?

Community
  • 1
  • 1
jpo
  • 3,959
  • 20
  • 59
  • 102

1 Answers1

1

You should pass activation data in show:

 var routedata = 90;
 this.dialog = new CustomDialog('My title', new DialogModel());
 this.dialog.show(routedata);

And proxy it in your CustomDialog:

define(['plugins/dialog'], function (dialog) {
    var CustomModal = function (title, model) {
        this.title = title;
        this.model = model;
    };

    CustomModal.prototype.ok = function() {
         dialog.close(this, this.model);
     };

    CustomModal.prototype.show = function(activationData){
       return dialog.show(this, activationData);
    };

    return CustomModal;
});
Dziamid
  • 11,225
  • 12
  • 69
  • 104
  • 1
    Seems to worl well with the show return being return dialog.show('viewmodels/MyModel, activationData). I can get the parameter passed in the activiate method. However,, when I use return dialog.show(this, activationData), the parameter is undefined. – jpo Dec 22 '14 at 22:34