I did see DataGrid, and dismissed it because it didn't fit my needs at
the time.
I'll take a check at datacontroller.py and see what it's like! Cheers
for the tip!
I've been using widgets a bit more - they are very nice!
I have run into another little "gotcha": widget.SelectField's template
is missing a bracket in it's template just before widget.name.
class SelectField(Widget):
template = """
<div xmlns:py="http://purl.org/kid/ns#">
<select name="$widget.name}">
<option py:for="option in widget.options"
value="${option['value']}"
selected="${option['selected']}">${option['text']}</option>
</select>
</div>
"""
It's probably already been fixed, but just to make sure...
Regards,
Mark.
Kevin Dangoor wrote:
> We need to either get rid of that grid or update it to be stateless
> and take the value as input. I've manipulated it myself for the CRUD
> stuff, but my changes were in the general direction of CRUD. Take a
> look at turbogears/fastdata/datacontroller.py and the DataGrid class
> in there. You'll see that the rows/columns are not passed in by the
> constructor, but rather a SelectResults is passed in at insert() time.
>
> Kevin
>
> On 12/16/05, Mark Godfrey <[EMAIL PROTECTED]> wrote:
> >
> > I've been playing around with turbogears.widget.grid for a few days,
> > pushing it to see how far I can push it.
> >
> > I've been using it to have a kind of "ClickyGridWidget" - where users
> > can mouse over and click rows to expand them.
> >
> > I've come across some troubles using javascript for mouseovers that we
> > recently resolved, and I thought I'd give the solution to back to the
> > community.
> >
> > The main one was the header row was being highlighted in IE because it
> > was still using TR's, so we couldn't easily differentiate between
> > header and data. This was fixed by using th tags instead of tr tags.
> >
> > I also expanded it so that it used tbody tags as well as thead - if
> > we're going to use one , we may as well use the other too :)
> >
> > I'm not sure who to direct this to, so here's an amazingly long patch
> > against turbogears/widgets/grid.py
> >
> > Have fun!
> >
> > I'll create a proper widget to implement this kind of behaviour soon -
> > I'm starting to find it immensely useful!
> >
> > --- turbogears/widgets/grid.py 2005-12-16 13:50:49.000000000 +0000
> > +++ turbogears/widgets_new/grid.py 2005-12-16 13:54:43.000000000
> > +0000
> > @@ -11,15 +11,17 @@
> > <link href="/tg_static/css/widget.css" type="text/css"
> > rel="stylesheet" />
> > <table id="${widget.name}" class="grid" cellpadding="0"
> > cellspacing="1" border="0">
> > <thead py:if="widget.headers">
> > - <td py:for="head in widget.headers">
> > + <th py:for="head in widget.headers">
> > ${head}
> > - </td>
> > + </th>
> > </thead>
> > - <tr py:for="i, row in enumerate(widget.rows)" class="${i%2 and
> > 'odd' or 'even'}">
> > - <td py:for="cell in row">
> > - ${cell}
> > - </td>
> > - </tr>
> > + <tbody>
> > + <tr py:for="i, row in enumerate(widget.rows)" class="${i%2 and
> > 'odd' or 'even'}">
> > + <td py:for="cell in row">
> > + ${cell}
> > + </td>
> > + </tr>
> > + </tbody>
> > </table>
> > </div>
> > """
> >
> >
>
>
> --
> Kevin Dangoor
> Author of the Zesty News RSS newsreader
>
> email: [EMAIL PROTECTED]
> company: http://www.BlazingThings.com
> blog: http://www.BlueSkyOnMars.com