you may want to have a look here http://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

Reply via email to