Yes, i have a helper function that can build the appropriate options list.
Here is a sample select list and the util fnc making the values that go in:
objectSubTypeID = widgets.SingleSelectField(label="Object Type",
legend=_("Type"),validator=validators.Int,
options=myprojectweb.utils.makeOptions(myprojectweb.model.objectSubType.sele
ct(),'subTypeName'))
def makeOptions(results, labelColumn, seperatorColumn=None,
AddNull=False,MultiLang=False):
values = []
for result in results:
try:
label = getattr(result,labelColumn)
except:
if MultiLang == True:
label = 'LabelNotFound'
else:
for lang in list(myprojectweb.model.languages.select()):
label[lang.languageCode] = 'Error'
if MultiLang == False:
values.append((result.id,
label[myprojectweb.utils.getActiveLanguage()]))
else:
values.append((result.id, label))
if AddNull == True:
values.insert(0,('-1',' '))
return values
Thank you,
Fabian
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Ian Wilson
Sent: 27 February 2007 08:08
To: [email protected]
Subject: [TurboGears] Re: Select Field entries not updating? Are they being
cached?
Are you passing a callable at instantiation time? Can you show me a snippet
of code where you set the options?
-Ian
On 2/26/07, schnuer.com <[EMAIL PROTECTED]> wrote:
>
> Both via instanciation and value during display time and finally ajax
call.
> It does not work when doing it at instanciation time.
>
> Fabian
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
> On Behalf Of Ian Wilson
> Sent: 26 February 2007 10:16
> To: [email protected]
> Subject: [TurboGears] Re: Select Field entries not updating? Are they
> being cached?
>
>
> How are you loading the options in the widget's select field ? At
> widget instantiation or by passing them in at display time ?
>
> -Ian
>
> On 2/25/07, schnuer.com <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> > I'm using widgets. I guess if i did it by hand it would work since
> > when i output the same information with a py:if as just text in the
> > template it shows up as it should.
> >
> > Fabian
> >
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[EMAIL PROTECTED]
> > On Behalf Of Ian Wilson
> > Sent: 26 February 2007 00:19
> > To: [email protected]
> > Subject: [TurboGears] Re: Select Field entries not updating? Are
> > they being cached?
> >
> >
> > How are you putting the options into the select fields? Are you
> > using widgets or just doing it by hand ?
> >
> > -Ian
> >
> > On 2/25/07, schnuer.com <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > > In my project i have several cases where on for example controller
> > > A i can add items to the database that are then going to be
> > > possible options in a select or multiple select field in controller B.
> > >
> > > Now when i add something new it works fine, in the database the
> > > things turn up and when looping over them to write them into a
> > > template as html everything shows up. But when i then navigate
> > > over to controller B the new items don't show up in the (multiple)
> > > select field until i restart turbogears.
> > >
> > > when i hit controller B with another browser however it is being
> > > updated. So somehow i guess the browser must cache these lists (IE
> > > and firefox both show this behaviour). Both controller A and B are
> > > secure resources so a session is maintained. Might that be the
> > > reason or is it something completely different? Most importantly
> > > however, how do i get
> > around this?
> > >
> > > Thank you,
> > > Fabian
> > >
> > >
> > > >
> > >
> >
> >
> >
> >
> > >
> >
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---