I was just experimenting with the patch for pagination #1115. It mentioned
using compound widgets so I took the compound widget example and
Bob's your uncle...
I have been experimenting with pagination for a while. You pointed me in
the right direction when you showed me the proper syntax for setting up
the GET URL properly for multiselects.
There is a pagination issue with complex forms and pagination grids.
The number links created aren't rendered correctly for non-scalar
types like dicts and lists. Randall's patch adresses that to some degree.
He included a dict mapping and with your help I added a list mapping.
All the other stuff I went through was more or less cr*p. I thought validation
would help with the input parsing so I added that. Of course the urls created by
the pagination decorator rendered the value for the mulitpleselect as a
string like "[1,2]" and not in the format you mentioned. With POST on the
form this was not a problem but the number links created perform a GET
to the action.
Thanks for bridging that gap for me.
Nicky
On 9/25/06,
Ian Wilson <[EMAIL PROTECTED]> wrote:
Whoa interesting style. How come you don't just use the fields
directly? Why make your own compound widget? I am not sure the whole
system of setting the params and stuff will work with how you are
using them right there. And for the most part I was told to avoid
using ForEach because usually that is done automatically for option
oriented widgets(CheckBoxList for example).
-Ian
On 9/25/06, Nicky Ayoub <[EMAIL PROTECTED] > wrote:
> The change didn't work. The post by Ian is putting me on the right track.
> The syntax for encoding a multiple select does not use sqaure braces. I
> think the code in pagination.py needs to change the way it encodes lists
> that are passed into it. I'll try to experiment there next.
> Thanks for your help.
>
> On 9/25/06, Adam Jones <[EMAIL PROTECTED]> wrote:
> >
> >
> > Try moving your int validator into the CheckBoxList instantiation. It
> > will look something like this:
> >
> > class MyMacroFilterFormValidator(validators.Schema):
> > macro = validators.String(not_empty=False, if_empty=''),
> > designer = validators.String(not_empty=False, if_empty=''),
> >
> > class MyMacroFilterFormField(CompoundFormField):
> > member_widgets = [ "macro","status", "designer"]
> > template = """
> > <div xmlns:py="http://purl.org/kid/ns# ">
> > <table border="1">
> > <tr>
> > <th>Macro Name</th>
> > <th>Status</th>
> > <th>Designer</th>
> > </tr>
> > <tr>
> > <td>${display_field_for(macro)}</td>
> > <td>${display_field_for(status)}</td>
> > <td>${display_field_for(designer)}</td>
> > </tr>
> > </table>
> > </div>
> > """
> > def __init__(self, m_params={}, s_params={}, d_params={}, *args,
> > **kw):
> >
> super(MyMacroFilterFormField,self).__init__(*args,**kw)
> > self.macro = TextField("macro",
> > **m_params)
> > self.status = CheckBoxList("status",
> > options = [(0,'zero'),
> > (1,'one'),(2,'two')],
> >
> validator=validators.Int(),
> > **s_params)
> > self.designer = TextField("designer",
> > **d_params)
> >
> >
> >
> > G-Mail Account
> > > >
> >
>
--
--
Nicky Ayoub
G-Mail Account
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

