Well, using the pattern for plugin creation will make your life easier, and
"this" will make more sense.
Reading your code, it feels like you are using the structuration promoted by
another library


On Mon, Nov 10, 2008 at 6:29 PM, George <[EMAIL PROTECTED]> wrote:

>
> I had looked there probably 10 times :)
> Are you implying that I need to convert my code to being Plug-In?
> Other than that I do not see how this page
> http://docs.jquery.com/Plugins/Authoring
> answers my question...
> Sorry, but please spell it out for me.
>
> The Plug-In would be the next step for me.. But as of now I am trying
> to nail down the use of 'this' in JavaScript as it's a bit different
> from what I am used to.
>
>
> George.
>
> On Nov 10, 11:43 am, "Olivier Percebois-Garve" <[EMAIL PROTECTED]>
> wrote:
> > you may want to have a look herehttp://docs.jquery.com/Plugins/Authoring
> >
> >
> >
> > On Mon, Nov 10, 2008 at 5:20 PM, George <[EMAIL PROTECTED]> wrote:
> >
> > > Being newbie in JavaScript I am trying to code my own helper object
> > > that does pagination.
> > > So here is a snippet of my code.
> >
> > > MyData.prototype = {
> > >  ....blablabla...
> > >   PageUp: function() {
> > >        this.iFrom += this.pageSize;
> > >        this.CheckPageIndex();
> > >    },
> >
> > >    CheckPageIndex: function() {
> > >        if( this.iFrom >= this.data.length )
> > >            this.iFrom = Math.floor((this.data.length - 1)/
> > > this.pageSize) * this.pageSize;
> >
> > >        if( this.iFrom < 0 )
> > >            this.iFrom = 0;
> > >    }
> >
> > > }
> >
> > > Why do I need to call CheckPageIndex using this.CheckPageIndex when
> > > called from PageUp? It's in the same object...
> >
> > > Without 'this' I get an error 'CheckPageIndex is undefined'. Coming
> > > from object oriented languages like C++ I have a trouble
> > > understanding
> > > it.
> > > Or am I doing it wrong and there is a way not to specify 'this' to
> > > many times?
> >
> > > Thanks
> > > George- Hide quoted text -
> >
> > - Show quoted text -

Reply via email to