[Proto-Scripty] Re: Object.extend equivelant

2009-11-09 Thread kstubs

It is defined like this:

var GridBuild = function(){};

Object.extend(Object.extend(GridBuild.prototype, GridBase.prototype),
... code cut here ...

{


On Nov 9, 7:30 am, "T.J. Crowder"  wrote:
> Hi,
>
> > I get an error in prototypejs, "parent.subclasses is undefied" (occurs
> > at line 99) the code is:
>
> > parent.subclasses.push(klass);
>
> > Any ideas?
>
> The superclass (parent) must be a class that was defined with
> Class.create; from that error, I'm thinking GridBuild is defined
> "raw" (or in some other non-Class.create method).
>
> HTH,
>
> -- T.J. :-)
>
> On Nov 9, 2:18 am, kstubs  wrote:
>
>
>
> > If I do something like this:
>
> > var GymnastFind = Class.create(GridBuild,
> > Ajax.Application.Base.Prototype, UserState, {
> >     HEAD: ['MSOID', 'USAG', 'Description', 'DOB'],
> >     initialize: function(container, url) {
> >         this.url = url;
> >         this.container = $(container).select('div.grid_container')[0];
> >         this.Form = $(container).select('form')[0]
> >         this.Form.observe('keyup', this.form_keyup.bind(this));
> >     },
>
> > ... code cut here ...
>
> > I get an error in prototypejs, "parent.subclasses is undefied" (occurs
> > at line 99) the code is:
>
> > parent.subclasses.push(klass);
>
> > Any ideas?  Maybe I can't mix in Ajax.Application.Base, maybe I must
> > inherit it?  So am I correct in assuming that the Javascript allows
> > you to inherit from more than one class, an in my previous
> > "Object.extend(Object.extend ..." syntax I am doing just this?
>
> > Thanks for the help.
> > Karl..
>
> > On Nov 8, 2:45 am, "T.J. Crowder"  wrote:
>
> > > Hi Karl,
>
> > > Class.create accepts a base class and multiple mix-ins[1]. The way
> > > JavaScript's instanceof operator works, you can't create a new class
> > > from two disparate base classes and have the new class be an
> > > "instanceof" both of the base classes, you have to choose one as a
> > > base and mix-in the other, but that's fine if the code you quoted is
> > > working for you, nothing is relying on instances of GymnastFind being
> > > "instanceof" Ajax.Application.Base.
>
> > > So if you want it to derive from GridBuild and mix-in
> > > Ajax.Application.Base:
>
> > > var GymnastFind = Class.create(GridBuild,
> > > Ajax.Application.Base.prototype);
>
> > > (Note that for the base class, we specify the class [the constructor
> > > function] rather than the prototype, but mix-ins are specified just as
> > > an object, so we use the prototype of Ajax.Application.Base.)
>
> > > If you want to specify your own methods as well, just include them as
> > > an object as a third parameter.
>
> > > [1]http://api.prototypejs.org/language/class.html
>
> > > HTH,
> > > --
> > > T.J. Crowder
> > > Independent Software Consultant
> > > tj / crowder software / comwww.crowdersoftware.com
>
> > > On Nov 7, 6:21 pm, kstubs  wrote:
>
> > > > The following is working, but I am looking for the pure prototypejs
> > > > equivelant.  So, what would the equivilant code be for
>
> > > > var GymnastFind = Class.create();
> > > > Object.extend(Object.extend(GymnastFind.prototype,
> > > > GridBuild.prototype));
> > > > Object.extend(Object.extend(GymnastFind.prototype,
> > > > Ajax.Application.Base.prototype), {
> > > >     HEAD: ['MSOID', 'USAG', 'Description', 'DOB'],
> > > >     initialize: function(container, url) {
> > > >         this.UserActive = false;
> > > >         this.timer = null;
> > > > .. code cut here ..
>
> > > > });
>
> > > > In plain English:
>
> > > > Create a GymnastFind Class which inherits from GridBuild class and
> > > > implements the abstract class Ajax.Application.Base.
>
> > > > Thanks,
> > > > Karl..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Object.extend equivelant

2009-11-09 Thread T.J. Crowder

Hi,

> I get an error in prototypejs, "parent.subclasses is undefied" (occurs
> at line 99) the code is:
>
> parent.subclasses.push(klass);
>
> Any ideas?

The superclass (parent) must be a class that was defined with
Class.create; from that error, I'm thinking GridBuild is defined
"raw" (or in some other non-Class.create method).

HTH,

-- T.J. :-)

On Nov 9, 2:18 am, kstubs  wrote:
> If I do something like this:
>
> var GymnastFind = Class.create(GridBuild,
> Ajax.Application.Base.Prototype, UserState, {
>     HEAD: ['MSOID', 'USAG', 'Description', 'DOB'],
>     initialize: function(container, url) {
>         this.url = url;
>         this.container = $(container).select('div.grid_container')[0];
>         this.Form = $(container).select('form')[0]
>         this.Form.observe('keyup', this.form_keyup.bind(this));
>     },
>
> ... code cut here ...
>
> I get an error in prototypejs, "parent.subclasses is undefied" (occurs
> at line 99) the code is:
>
> parent.subclasses.push(klass);
>
> Any ideas?  Maybe I can't mix in Ajax.Application.Base, maybe I must
> inherit it?  So am I correct in assuming that the Javascript allows
> you to inherit from more than one class, an in my previous
> "Object.extend(Object.extend ..." syntax I am doing just this?
>
> Thanks for the help.
> Karl..
>
> On Nov 8, 2:45 am, "T.J. Crowder"  wrote:
>
>
>
> > Hi Karl,
>
> > Class.create accepts a base class and multiple mix-ins[1]. The way
> > JavaScript's instanceof operator works, you can't create a new class
> > from two disparate base classes and have the new class be an
> > "instanceof" both of the base classes, you have to choose one as a
> > base and mix-in the other, but that's fine if the code you quoted is
> > working for you, nothing is relying on instances of GymnastFind being
> > "instanceof" Ajax.Application.Base.
>
> > So if you want it to derive from GridBuild and mix-in
> > Ajax.Application.Base:
>
> > var GymnastFind = Class.create(GridBuild,
> > Ajax.Application.Base.prototype);
>
> > (Note that for the base class, we specify the class [the constructor
> > function] rather than the prototype, but mix-ins are specified just as
> > an object, so we use the prototype of Ajax.Application.Base.)
>
> > If you want to specify your own methods as well, just include them as
> > an object as a third parameter.
>
> > [1]http://api.prototypejs.org/language/class.html
>
> > HTH,
> > --
> > T.J. Crowder
> > Independent Software Consultant
> > tj / crowder software / comwww.crowdersoftware.com
>
> > On Nov 7, 6:21 pm, kstubs  wrote:
>
> > > The following is working, but I am looking for the pure prototypejs
> > > equivelant.  So, what would the equivilant code be for
>
> > > var GymnastFind = Class.create();
> > > Object.extend(Object.extend(GymnastFind.prototype,
> > > GridBuild.prototype));
> > > Object.extend(Object.extend(GymnastFind.prototype,
> > > Ajax.Application.Base.prototype), {
> > >     HEAD: ['MSOID', 'USAG', 'Description', 'DOB'],
> > >     initialize: function(container, url) {
> > >         this.UserActive = false;
> > >         this.timer = null;
> > > .. code cut here ..
>
> > > });
>
> > > In plain English:
>
> > > Create a GymnastFind Class which inherits from GridBuild class and
> > > implements the abstract class Ajax.Application.Base.
>
> > > Thanks,
> > > Karl..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Object.extend equivelant

2009-11-08 Thread kstubs

UPDATE!

This works:
var GymnastFind =
Class.create(GridBuild.prototype,
 Ajax.Application.Base.prototype,
 UserState, {
HEAD: ['MSOID', 'USAG', 'Description', 'DOB'],
initialize: function(container, url) {
this.url = url;
this.container = $(container).select('div.grid_container')[0];
this.Form = $(container).select('form')[0]
this.Form.observe('keyup', this.form_keyup.bind(this));
},


Since GridBuild is declared as a function, then I suppose I am only
mixing in it's methods and not inheriting from it as a class.
Therefore I must refer to the prototype property of GridBuild, and
same thing for the Ajax.Application.Base object?

Karl..

On Nov 8, 2:45 am, "T.J. Crowder"  wrote:
> Hi Karl,
>
> Class.create accepts a base class and multiple mix-ins[1]. The way
> JavaScript's instanceof operator works, you can't create a new class
> from two disparate base classes and have the new class be an
> "instanceof" both of the base classes, you have to choose one as a
> base and mix-in the other, but that's fine if the code you quoted is
> working for you, nothing is relying on instances of GymnastFind being
> "instanceof" Ajax.Application.Base.
>
> So if you want it to derive from GridBuild and mix-in
> Ajax.Application.Base:
>
> var GymnastFind = Class.create(GridBuild,
> Ajax.Application.Base.prototype);
>
> (Note that for the base class, we specify the class [the constructor
> function] rather than the prototype, but mix-ins are specified just as
> an object, so we use the prototype of Ajax.Application.Base.)
>
> If you want to specify your own methods as well, just include them as
> an object as a third parameter.
>
> [1]http://api.prototypejs.org/language/class.html
>
> HTH,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Nov 7, 6:21 pm, kstubs  wrote:
>
>
>
> > The following is working, but I am looking for the pure prototypejs
> > equivelant.  So, what would the equivilant code be for
>
> > var GymnastFind = Class.create();
> > Object.extend(Object.extend(GymnastFind.prototype,
> > GridBuild.prototype));
> > Object.extend(Object.extend(GymnastFind.prototype,
> > Ajax.Application.Base.prototype), {
> >     HEAD: ['MSOID', 'USAG', 'Description', 'DOB'],
> >     initialize: function(container, url) {
> >         this.UserActive = false;
> >         this.timer = null;
> > .. code cut here ..
>
> > });
>
> > In plain English:
>
> > Create a GymnastFind Class which inherits from GridBuild class and
> > implements the abstract class Ajax.Application.Base.
>
> > Thanks,
> > Karl..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Object.extend equivelant

2009-11-08 Thread kstubs

If I do something like this:

var GymnastFind = Class.create(GridBuild,
Ajax.Application.Base.Prototype, UserState, {
HEAD: ['MSOID', 'USAG', 'Description', 'DOB'],
initialize: function(container, url) {
this.url = url;
this.container = $(container).select('div.grid_container')[0];
this.Form = $(container).select('form')[0]
this.Form.observe('keyup', this.form_keyup.bind(this));
},

... code cut here ...

I get an error in prototypejs, "parent.subclasses is undefied" (occurs
at line 99) the code is:

parent.subclasses.push(klass);


Any ideas?  Maybe I can't mix in Ajax.Application.Base, maybe I must
inherit it?  So am I correct in assuming that the Javascript allows
you to inherit from more than one class, an in my previous
"Object.extend(Object.extend ..." syntax I am doing just this?

Thanks for the help.
Karl..


On Nov 8, 2:45 am, "T.J. Crowder"  wrote:
> Hi Karl,
>
> Class.create accepts a base class and multiple mix-ins[1]. The way
> JavaScript's instanceof operator works, you can't create a new class
> from two disparate base classes and have the new class be an
> "instanceof" both of the base classes, you have to choose one as a
> base and mix-in the other, but that's fine if the code you quoted is
> working for you, nothing is relying on instances of GymnastFind being
> "instanceof" Ajax.Application.Base.
>
> So if you want it to derive from GridBuild and mix-in
> Ajax.Application.Base:
>
> var GymnastFind = Class.create(GridBuild,
> Ajax.Application.Base.prototype);
>
> (Note that for the base class, we specify the class [the constructor
> function] rather than the prototype, but mix-ins are specified just as
> an object, so we use the prototype of Ajax.Application.Base.)
>
> If you want to specify your own methods as well, just include them as
> an object as a third parameter.
>
> [1]http://api.prototypejs.org/language/class.html
>
> HTH,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Nov 7, 6:21 pm, kstubs  wrote:
>
>
>
> > The following is working, but I am looking for the pure prototypejs
> > equivelant.  So, what would the equivilant code be for
>
> > var GymnastFind = Class.create();
> > Object.extend(Object.extend(GymnastFind.prototype,
> > GridBuild.prototype));
> > Object.extend(Object.extend(GymnastFind.prototype,
> > Ajax.Application.Base.prototype), {
> >     HEAD: ['MSOID', 'USAG', 'Description', 'DOB'],
> >     initialize: function(container, url) {
> >         this.UserActive = false;
> >         this.timer = null;
> > .. code cut here ..
>
> > });
>
> > In plain English:
>
> > Create a GymnastFind Class which inherits from GridBuild class and
> > implements the abstract class Ajax.Application.Base.
>
> > Thanks,
> > Karl..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Object.extend equivelant

2009-11-08 Thread T.J. Crowder

Hi Karl,

Class.create accepts a base class and multiple mix-ins[1]. The way
JavaScript's instanceof operator works, you can't create a new class
from two disparate base classes and have the new class be an
"instanceof" both of the base classes, you have to choose one as a
base and mix-in the other, but that's fine if the code you quoted is
working for you, nothing is relying on instances of GymnastFind being
"instanceof" Ajax.Application.Base.

So if you want it to derive from GridBuild and mix-in
Ajax.Application.Base:

var GymnastFind = Class.create(GridBuild,
Ajax.Application.Base.prototype);

(Note that for the base class, we specify the class [the constructor
function] rather than the prototype, but mix-ins are specified just as
an object, so we use the prototype of Ajax.Application.Base.)

If you want to specify your own methods as well, just include them as
an object as a third parameter.

[1] http://api.prototypejs.org/language/class.html

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com



On Nov 7, 6:21 pm, kstubs  wrote:
> The following is working, but I am looking for the pure prototypejs
> equivelant.  So, what would the equivilant code be for
>
> var GymnastFind = Class.create();
> Object.extend(Object.extend(GymnastFind.prototype,
> GridBuild.prototype));
> Object.extend(Object.extend(GymnastFind.prototype,
> Ajax.Application.Base.prototype), {
>     HEAD: ['MSOID', 'USAG', 'Description', 'DOB'],
>     initialize: function(container, url) {
>         this.UserActive = false;
>         this.timer = null;
> .. code cut here ..
>
> });
>
> In plain English:
>
> Create a GymnastFind Class which inherits from GridBuild class and
> implements the abstract class Ajax.Application.Base.
>
> Thanks,
> Karl..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---