#2235: DataGrid and pagination tutorial/reference missing for TG2
---------------------------------+------------------------------------------
 Reporter:  chrisz               |        Owner:        
     Type:  documentation        |       Status:  new   
 Priority:  normal               |    Milestone:  2.0rc1
Component:  Documentation        |      Version:  2.0b5 
 Severity:  normal               |   Resolution:        
 Keywords:  datagrid pagination  |  
---------------------------------+------------------------------------------
Comment (by lszyba1):

 {{{
 #Documentation below:

 One way to provide links is to send the html markup to actual datagrid
 column. In a normal situation you would send just a "name":

 # data grid
 from tw.forms.datagrid import DataGrid

 cogbin_grid = [('Package Name',name),
                 ('Version','version'),
                 ('Summary','summary'),
                 ('Author','author'),
                 ]

 To send the link url you can tell create html link tag with field to
 include. Below we provide home_page and name to our link:

 from genshi import Markup
 def get_link(item):
     return Markup("""<a href="%s">%s</a>""" % (item.home_page,item.name))

 #data grid
 from tw.forms.datagrid import DataGrid

 cogbin_grid = [('Package Name',name),
                 ('Version','version'),
                 ('Summary','summary'),
                 ('Author','author'),
                 ]


 Another use is to create a edit button which would look like this:

 from genshi import Markup
 def get_link(item):
     return Markup("""<a href="edit/%s">Edit</a>""" % item.id)

 }}}

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2235#comment:1>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to