[Seaside] Twitter Bootstrap Pagination issue
Lawrence Kellogg
mac.hive at me.com
Wed Mar 21 15:32:31 UTC 2012
On Mar 21, 2012, at 10:01 AM, Nick Ager wrote:
> I think you want to assign WAValueHolder to a temporary, something like:
>
> | pageNumberHolder |
> pageNumberHolder := WAValueHolder with: pageNumber.
>
> html listItem
> class: (self pageNumberActiveForPage: pageNumberHolder contents);
> with: [ html anchor
> callback: [ self goToPage: pageNumberHolder contents ];
> with: pageNumber ]].
>
Well, I tried this, and I still can't get it to work. Does it matter where I declare pageNumberHolder?
I have tried declaring it in the innermost block, and as a local to the method, and in between,
but it still fails. Stumped.
Larry
> On 21 March 2012 13:35, Lawrence Kellogg <mac.hive at me.com> wrote:
>
> On Mar 21, 2012, at 9:11 AM, Nick Ager wrote:
>
>> Hi,
>>
>> It might be that you are seeing this issue: http://code.google.com/p/glassdb/issues/detail?id=221
>> discussion: http://forum.world.st/use-of-method-temporaries-in-callback-blocks-td2340788.htm
>>
>> You can work around it by using a WAValueHolder
>>
>
> Thanks, Nick, I knew it was some sort of a problem related to temporaries in blocks.
> Unfortunately, this:
>
> html listItem
> class: (self pageNumberActiveForPage: (WAValueHolder with: pageNumber));
> with: [ html anchor
> callback: [ self goToPage: (WAValueHolder with: pageNumber) ];
> with: pageNumber ]].
>
> does not fix the problem. I am calling contents in the receiving methods, of course.
>
> Am I doing something wrong in terms of using a WAValueHolder to fix the problem?
>
> Larry
>
>> Hope this helps
>>
>> Nick
>>
>> On 21 March 2012 12:03, Lawrence Kellogg <mac.hive at me.com> wrote:
>> Hello,
>> So, while we're on the subject of Twitter Bootstrap, I have run
>> into a strange issue while moving my code into GLASS. I am using the
>> Pagination control from Twitter Bootstrap.
>>
>> I have this code to generate the pagination control
>>
>> html div
>> class: 'pagination';
>> with: [
>> html unorderedList: [
>> ...
>> startPageNumber to: endPageNumber do: [ :pageNumber |
>> html listItem
>> class: (self pageNumberActiveForPage: pageNumber);
>> with: [ html anchor
>> callback: [ self goToPage: pageNumber ];
>> with: pageNumber ]
>> …]]
>>
>> which generates this:
>>
>> <div class="pagination"><ul><li class="prev disable"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&38">Previous</a></li><li class="active"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&39">1</a></li><li class="inactive"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&40">2</a></li><li class="inactive"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&41">3</a></li><li class="inactive"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&42">4</a></li><li class="inactive"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&43">5</a></li><li class="inactive"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&44">6</a></li><li class="inactive"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&45">7</a></li><li class="inactive"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&46">8</a></li><li class="inactive"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&47">9</a></li><li class="inactive"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&48">10</a></li><li class="next"><a href="/PracticeJournalLoginTask?_s=iwwzfPJxijSN6asi&_k=1rwinvTch1gVzvnC&49">Next</a></li></ul></div>
>>
>> but when that goToPage: method is called, the pageNumber value is always the last one in the list, 10 in this case, even
>> when I clicked on page 2. This code works fine on my local Seaside/Pharo image so I am kind of puzzled as to what is going on. Any thoughts?
>>
>> Larry
>>
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20120321/3e605b23/attachment-0001.htm
More information about the seaside
mailing list