Hi Massimo,
I am new to T2, so forgive me if the following issues are not
correct. :P
1.Pagination bug in search()
Pagination works fine when using t2.itemize(), but neither "[next
page]" nor "[previous page]" works when using t2.search(). I check the
code. It seems they only work when you hit the submit button. Not
intuitive enough. Any better solution?
2.Improve pagination in itemize()
Change the nav=..... inside t2.py's itemize(), into the following. I
believe it is much better, not only because it is function rich, but
also because the UI is so intuitive that it does not need i18n at all!
nav=[TR(TD( # Iceberg at 21cn dot com prefers this style of page
navigation :-)
INPUT(_type='button',_value='|
<',_onclick='javascript:location="%s"'%self.action
(args=request.args,vars={'_page':0})) if page else '',
INPUT
(_type='button',_value='<',_onclick='javascript:location="%s"'%self.action
(args=request.args,vars={'_page':page-1})) if page else '',
SELECT(value=page,_onchange='javascript:location="%s?
_page="+this.value'%self.action(args=request.args),
*[OPTION(i+1,_value=i) for i in xrange(rows_count/nitems
+1)]),
INPUT
(_type='button',_value='>',_onclick='javascript:location="%s"'%self.action
(args=request.args,vars={'_page':page+1})) if page*nitems+len(rows)
<rows_count else '',
INPUT
(_type='button',_value='>|',_onclick='javascript:location="%s"'%self.action
(args=request.args,vars={'_page':rows_count/nitems})) if page*nitems
+len(rows)<rows_count else '',
_colspan=999))] # To make sure the first column of table
will not become unnecessarily large
3.Customize the table header of itemize()
Although you mentioned a trick to do so, in:
http://www.mail-archive.com/[email protected]/msg04358.html
The trick seems not apply to search(). Perhaps a new "tablehead"
parameter shall be introduced into itemize().
But anyway, the search widget is somewhat too "all-in-one", maybe I
will still have to build my own search page in my application.
4.Pending issue about the style of itemize output
I change the last clause of t2.py's itemize() to force the output
table has a _class='sortable', and insert the following paragraph at
the end of HEAD tag inside view/layout.html:
<script><!-- //To make the sortable table more beautiful
$(document).ready(function(){
$("table.sortable tbody tr").mouseover( function() {
$(this).addClass("highlight"); }).mouseout( function() {
$(this).removeClass("highlight"); });
$('table.sortable tbody tr:odd').addClass('odd');
$('table.sortable tbody tr:even').addClass('even');
});
//--></script>
this way the itemize() output is more friendly (I think).
Actually I tried to use same approach to define a set of new style
named "t2-itemize" in both view/layout.html and static/style.css, to
suit t2.py's original itemize(). But somehow it didn't work. So I just
point out this issue here and let some other css expert to handle it.
5. Minor suggestion.
I suggest to put a link to T2 (now T3) at the web2py homepage i.e.
www.web2py.com, for easier accessing T3. And a version number of T3 is
recommended. Just now, I have to use google to find T3 website and
then download it again, to make sure I am using the latest version of
T3 before I decide to write this post.
Oh, did I mention that I love T2 already? :-)
Sincerely,
Iceberg, 2009-Jan-05, 21:42(PM), Mon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---