colinlin1982 / maashaack

Automatically exported from code.google.com/p/maashaack
0 stars 0 forks source link

PagebyPageIterator problem with lastPage() method #156

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Problem if a previous() method is invoked after a call of the lastPage() 
method.

Original issue reported on code.google.com by ekamel...@gmail.com on 7 May 2009 at 4:25

GoogleCodeExporter commented 9 years ago
For the moment if the lastPage() is invoked, and if the use must test if 
!it.hasPrevious... not use the it.previous() but it.current()

See the new example of the class :) 

TODO : refactoring the example with external class

Original comment by ekamel...@gmail.com on 7 May 2009 at 4:31

GoogleCodeExporter commented 9 years ago
Not a bug but a fix when use the iterator, see the example :
http://code.google.com/p/maashaack/source/browse/trunk/AS3/examples/maashaack/sy
stem/data/iterators/examples/PageByPageIteratorExample.as?spec=svn692&r=692

{{{
public function prev():void
{
    var prev:* ;
    if ( !it.hasPrevious())
    {
        prev = it.previous() ;     
    }
    else
    {
        it.lastPage() ;
        prev = it.current() ;
    }
    trace( "> prev:" + prev + " currentPage:" + it.currentPage() + " current:" +
eden.serialize(it.current()) ) ;
}

}}}

Original comment by ekamel...@gmail.com on 8 May 2009 at 12:24

GoogleCodeExporter commented 9 years ago
oops... problem in the up example :)

{{{
public function prev():void
{
    var prev:* ;
    if ( it.hasPrevious())
    {
        prev = it.previous() ;     
    }
    else
    {
        it.lastPage() ;
        prev = it.current() ;
    }
    trace( "> prev:" + prev + " currentPage:" + it.currentPage() + " current:" +
eden.serialize(it.current()) ) ;
}

}}}

remove the ! in the condition

Original comment by ekamel...@gmail.com on 8 May 2009 at 12:26