On Sep 27, 2006, at 1:09 AM, Mike Coyle wrote:
>
> Hi Folks,
>
> What is the preferred way to display a hyperlink within a DataGrid
> widget?
You can define a function to process a field and return any
ElementTree instance you feel like. For example:
from elementtree import ElementTree as ET
def makeLink(obj):
link = ET.Element('a', href=obj.url)
link.text = obj.title
return link
Then when you define the grid's fields just place it there:
fields = [
('Date created', 'date_created'),
('Title', makeLink),
....
]
Your grid will have links with the object's title pointing to the
object's url.
HTH,
Alberto
P.S: You can use a widget instead of a function. It will receive obj
as it's value and you can do all sorts of fancy stuff with it. Keep
in mind that calling a widget is the same as "display()"ing it.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---