Is it reasonably easy easy to something like this with python?

Gerardo Herzig gherzig at fmed.uba.ar
Tue Aug 28 18:51:50 EDT 2007


walterbyrd wrote:

>On Aug 28, 1:31 pm, Gerardo Herzig <gher... at fmed.uba.ar> wrote:
>  
>
>>walterbyrd wrote:
>>    
>>
>
>  
>
>>The one who make that table sorteable is AJAX. Not php. The php part is
>>kind of trivial (so it would be `trivial' in python too). It just reads
>>some data and format it in an html table.
>>    
>>
>
>
>Thank you, that is great to know. What if there were 1000 records, and
>the table was paginated? I suppose, ajax would sort the front end, and
>backend language, and database, would soft behind the scene, or
>something?
>
>  
>
Im not an AJAX expert (not even close actually. In fact i just used it 
once), but seems like you will have to reload all the page (all the 
table at least). Because now is a different scenario. If the table is 
paginated, it looks like you will send, say 50 results at one time, then 
(when  pressing 'next 50'), anhoter 50, and so on. So AJAX only will 
have THOSE 50 for ordering. Another approach would be returning de 
entire recordset, and implement all the 'next' and 'previous' links via 
AJAX. And i dont think you will like to send the entire result. I dont.

What will i do (at least from WIK for now), is having a set of `hrefs' 
(maybe with some nice arrows) in all of the table headers, to indicate 
the desired order you want to get. And, if you have a column table named 
'age', you will make those href like
'<a 
href=showmethetable.py?columnorder=age&ordertype=asc><nice_arrow_graphic>'

then your cgi python script will take that mess after the ? sign, parse 
it (via cgi module perhaps), and make a new query, with the 'order by 
age asc' clause, wich are the 'arguments' in the url.

There is allways a lot of ways to do some stuff. I will check into de 
AJAX list too!

Cheers.
Gerardo



More information about the Python-list mailing list