Ryan: No I am defining that with a var -- besides I would get a differant error that blah.blah is not a contructor

Todd: The skeleton code I am using to create the base class is in my first email.

On 2/10/06, Ryan Gahl <[EMAIL PROTECTED]> wrote:

If my suggestion did not work then my next thought is that you are not actually defining "MyControls" first.

 

You can't define MyControls.TextBox is MyControls is not defined.

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of John Osborn
Sent: Friday, February 10, 2006 4:00 PM
To: rails-spinoffs@lists.rubyonrails.org
Subject: Re: [Rails-spinoffs] Prototype Inheritance example

 

Ryan,

Thank you for the quick response. I tried what you suggested and still no luck. I also found in scriptaculous.js another example of inheritance that might also work:

Autocompleter.Local = Class.create();
Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(),
{
    ..stuff
});

But that also did not work. Maybe I am creating the base class incorrectly?
There error I keep getting is: MyObject.SubObject is not a constructor (firefox latest)

Thanks again for any help.

On 2/10/06, Ryan Gahl <[EMAIL PROTECTED] > wrote:

You're missing a level of extension in the 2nd object. It should be…

 

Object.extend(Object.extend(MyControls.EditableTextbox.prototype, MyControls.TextBox.prototype),

{

            …stuff here…

});

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of John Osborn
Sent: Friday, February 10, 2006 1:45 PM
To: Rails-spinoffs@lists.rubyonrails.org
Subject: [Rails-spinoffs] Prototype Inheritance example

 

Hello Everyone,

I am working on a control collection for _javascript_/Ajax.Net. I am stuck on the class inheritance aspects of the prototype library. If someone could point me to an example it would be a great help. I have looked through the controls.js of the scriptaculous library and found something like the below code, but everytime I ran it I would get a constructor error.

Thanks for any help;

Looking for something like:

MyControls.TextBox = Class.create();
MyControls.TextBox.prototype =
{
  baseInitialize: function(loadCallback, saveCallback, saveOptions)
  {
    this.loadCallback  = loadCallback;
    this.saveCallback = saveCallback;
    ....
  },

  Save: function()
  {
    //do save operation using options
  }
};

MyControls.EditableTextBox = Class.create();

Object.extend(MyControls.EditableTextBox.prototype , MyControls.TextBox.prototype),
{
  initialize: function(targetObj, loadCallback, saveCallBack, options)
  {
    this.baseInitialize(loadCallback, saveCallback);
  },

  Update: function()
  {
     this.Save();
  }
}

The information transmitted in this electronic mail is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material.  Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.


_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs




--
that's how i roll,
jx

The information transmitted in this electronic mail is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material.  Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.


_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to