On Wednesday, September 7, 2016 at 6:52:01 PM UTC-7, Dave S wrote:
>
> [...] 
>
Python dictionaries do not guarantee any particular ordering.  Python lists 
> do, and the DAL Rows object is a special subclass of a list,
> and your inv_list should have the ordering that your query gave it, and 
> the dict you wrap it in should have inv_list 
>
as its first (and only) element
>

until you put the other two object back in!   8-O

 

> , and the view processor should preserve that to give you same order.
>
> If you do (as in the book ... Chapter 6) 
> {{=inv_list}}
>
>
> <URL:http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=Rows#Serializing-Rows-in-views>
>
> this will be translated to 
> {{=SQLTABLE(inv_list)}}
>
>
>
> which should display things in the proper order.
>
> An explicit for-loop (if you need finer layout control), it could look 
> something like
>
> <ul>
> {{for i in range(0,len(inv_list)):}}
>   {{=LI(inv_list[i])}}
> {{pass}}
> </ul>
>
>
>
> which should be equivalent to 
>
> <ul>
> {{for inv_item in inv_list:}}
>   {{=LI(inv_item)}}
> {{pass}}
> </ul>
>
>
> If this doesn't answer your question, please post your view code so we can 
> give better answers.
>
> /dps
>
>  
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to