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

Pass Params to YAHOO.widget.Button Object literal

Expand Messages
  • chaluwa
    Hello people, I have a mechanism (function) that makes UI widgets (eg SimpleDialog)for my apps, and it accepts parameters for making the widget, for my
    Message 1 of 1 , Oct 12, 2007
    • 0 Attachment
      Hello people, I have a mechanism (function) that makes UI widgets (eg
      SimpleDialog)for my apps, and it accepts parameters for making the
      widget, for my SimpleDialog it accepts id, width, header, body, and an
      object literal used to make it's buttons.

      My Button literal looks thus :
      r_buttons = [
      {text:"Cancle", handler:function(){ this.hide(); }},
      {text:"OK", handler:appUtils.getProductForEdit, isDefault:true}
      ];

      where appUtils.getProductForEdit is some namespaced function I want to
      use to specifically handle this dialog's button, and appUtils also
      contain other functions for other widgets(other dialogs).

      And my dialog call is thus:
      myDialog = quickUI.simpleDialog("remotebrowser", "200px", "Select
      Listing", "<div id='remoteListings'></div>", r_buttons);
      of course quickUI.simpleDialog is yet another namespaced function.

      Here is the issue, I have an object (I called params)I'd like to pass
      to appUtils.getProductForEdit as a parameter, how do I do this, tried
      all I know without any luck.

      I also considered doing this instead :
      goBtn = new
      YAHOO.widget.Button({id:"getprodgo",label:"OK",isDefault:true});
      goBtn.on("click",appUtils.getProductForEdit,params,false);
      resetBtn = new YAHOO.widget.Button({id:"getprodreset",label:"Cancle"});
      resetBtn.on("click", function(){this.hide();});
      r_buttons = [resetBtn, goBtn];
      and passed r_buttons to the dialog call.
      this placed blank buttons on the dialog.

      I further added the container parameter to the above dose of
      r_buttons,setting it to the id of the dialog been created, this gave
      me strange results, I had the buttons I need, with the events attached
      and params passed, but saw two more blank buttons whose origin I
      cannot attest to.

      Please, I need urgent help on this.

      Thanks,
      Charles Odili
      University of Benin,
      Nigeria
    Your message has been successfully submitted and would be delivered to recipients shortly.