@Johnny Blonde aka Frank
No need to be *annoyed*, I've read that but thought there was a
simpler way of modifying the template through widget calls rather than
inheriting the template and overriding its cascading style sheets
(something which is not explained in the link you provided).
Johnny Blonde wrote:
> Did you read the link i sent you at all? *annoyed*
>
> [...]
> Unlike, FastDataGrid, DataGrid's template provides no customization
> hook. On the other hand it is really simple and easy to understand so
> if you need to customize DataGrid's representation simply copy it and
> tweak as you see fit. To use your template with a DataGrid use
> ''template'' constructor parameter, just like with any Widget.
> [...]
> Instead of two-element tuple you can use an instance of
> DataGrid.Column (or subclass thereof) when defining DataGrid's fields.
> This is only useful if you're using custom DataGrid template as well.
>
> The idea of the DataGrid.Column is to be able to specify arbitrary
> additional ''options'' along with a column which are then used in
> template to alter template's logic.
>
> Example:
>
> users_admin_form = DataGrid(fields=[
> DataGrid.Column('id', 'userId', 'ID',
> options=dict(sortable=True)),
> DataGrid.Column('name', 'displayName', 'Name',
> options=dict(sortable=True)),
> DataGrid.Column('loggedin', 'get_last_login', 'Last logged in'),
> ])
>
> Kid template:
>
> <div py:for="col in columns" py:strip="True">
> <?python sortable = col.get_option('sortable', False) ?>
> ...
> <a py:if="sortable" href="${geturl(sortby=col.name)}">${col.title}</
> a>
> ...
> </div>
> [...]
> http://tg.maetico.com/api/public/turbogears.widgets.datagrid.DataGrid-class.html
>
>
> On 23 Apr., 17:13, Disrupt07 <[EMAIL PROTECTED]> wrote:
> > Thanks.
> >
> > However, how can I customize the columns? E.g. I do not want the
> > column to show the title, I want my columns to be of the same height,
> > I want different background colours, I want links to be in the grid,
> > etc. etc. How can these customizations be done?
> >
> > Johnny Blonde wrote:
> > > Have a look at "Customizing DataGrid representation"
> > >http://docs.turbogears.org/1.0/DataGridWidget#id7
> >
> > > --Frank
> >
> > > On 23 Apr., 15:54, Disrupt07 <[EMAIL PROTECTED]> wrote:
> > > > Ok, thanks.
> >
> > > > But how should I change (override) the datagrid's widget to show, for
> > > > example. different background colours, etc.???
> >
> > > > Johnny Blonde wrote:
> > > > > maybe you try "datagrid"
> >
> > > > > Frank
> >
> > > > > On 23 Apr., 08:38, The Alchemist <[EMAIL PROTECTED]> wrote:
> > > > > > How about showing list elements in a grid-like form such as
> >
> > > > > > name1 name5 name9
> > > > > > name2 name6 name10
> > > > > > name3 name7 ...
> > > > > > name4 name8
> >
> > > > > > Is there a pre-made widget for this type of layout?
> >
> > > > > > Tks
> >
> > > > > > Ian Wilson wrote:
> > > > > > > I'm guessing you have tried using tg-admin toolbox and checking
> > > > > > > out
> > > > > > > the widget browser as well as checking the docs:
> >
> > > > > > >http://docs.turbogears.org/1.0/WidgetList?highlight=%28widget%29
> >
> > > > > > > You might try data grid.. or just roll your own.
> >
> > > > > > > What kind of "elements" ?
> >
> > > > > > > -Ian
> >
> > > > > > > On 4/20/07, Disrupt07 <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > I want to create a widget to show a list of elements. I am
> > > > > > > > trying to
> > > > > > > > find a pre-made widget which I can use to perform my task. Can
> > > > > > > > anyone
> > > > > > > > list the pre-made widgets available? and maybe show some
> > > > > > > > customizations I can do? Thank you.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---