from 
/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/paginate.py
        

as we can see it sorts only SelectResults or SASelectResults objects 
otherwise the sort function is skiped.
The demo you  have does not pass to it a such object.
Furthermore this approach to sort IMO is useful only for datagrid 
displaying few rows, for huge data the sort and pagination should be 
done before by the db query...


 66             if (SelectResults and isinstance(var_data, 
SelectResults)) or \
 67                (SASelectResults and isinstance(var_data, 
SASelectResults)):
 68                 row_count = var_data.count()
 69                 if ordering:
 70                     # Build order_by list.
 71                     order_cols = range(len(ordering))
 72                     for (colname, order_opts) in ordering.items():
 73                         col = sql_get_column(colname, var_data)
 74                         if not col:
 75                             raise StandardError, "The order column 
(%s) doesn't exist" % colname
 76                         order_by_expr = sql_order_col(col, 
order_opts[1])
 77                         order_cols[order_opts[0]] = order_by_expr
 78                     # May need to address potential of ordering already
 79                     # existing in var_data.
 80                     # SO and SA differ on this method name.
 81                     if hasattr(var_data, 'orderBy'):
 82                         var_data = var_data.orderBy(order_cols)
 83                     else:
 84                         var_data = var_data.order_by(order_cols)
 85             elif isinstance(var_data, list):
 86                 row_count = len(var_data)
 87             else:
 88                 raise 'Variable is not a list or SelectResults'


Maurizio Boscaini wrote:

>I repeat a previous question I send at  Feb 15, 5:31 pm:
>
>I would like to use the PaginateDataGrid with SQLAlchemy.
>In a previous message I read:
>"
>Hi Jorge,
>
>I patched paginate.py and I tryed it, the pagination is Ok, but the
>'sort' doesn't work.
>
>If you want take a look at it, the demo is here:
>http://www.allevatori.com/download/paginatedatagrid.tgz
>
>jo
>"
>This is also my experience. When I sort a PaginateDataGrid nothing
>happens.
>Someone can help me?
>
>thanks in advance
>mauri
>
>
>>
>  
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to