Loading ...
Sorry, an error occurred while loading the content.

3587RE: [ydn-javascript] Dialog Buttons , how to pass parameters to their handlers?

Expand Messages
  • Steven Peterson
    Aug 1, 2006
    • 0 Attachment

      The easiest way to do this is to use a closure, as in:

       

      var myObj = “x”;

       

      var handleSubmit = function() {

            alert(myObj);

      }

       

      If you do this, you can pass any object you’d like to the handlers.

       

      Steven Peterson

      Web Developer, Platform Engineering

      Yahoo!

       

       

      From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of Levan Dvalishvili
      Sent: Tuesday, August 01, 2006 3:14 PM
      To: ydn-javascript@yahoogroups.com
      Subject: [ydn-javascript] Dialog Buttons , how to pass parameters to their handlers?

       

      For Dialog Obj I want to pass parameters to functions  that listen to  built in button click actions

       

      Example :

      var myButtons = [ { text:"Submit", handler:this.filterDialogContainer.handleSubmit, isDefault:true }, { text:"reset to Default", handler:this.filterDialogContainer.handleDefault },

                    { text:"Cancel", handler:this.filterDialogContainer.handleCancel } ];

       

       

      I want to pass a parent object as parameter to handleSubmit function, since inside the function soce changes to dialog itself, how would I do that? Is it possible

      Something similar as it’s  done with event handler subscription :

      this.filterDialogContainer.dialog.manualSubmitEvent.subscribe(this.filterDialogContainer.handleManual, this, true);

       

      or maybe I have to tell it to adjust scope and give me this to be the parent object of the function that handles that buttons click?

       

       

      Best Regards.

    • Show all 10 messages in this topic