List Info

Thread: problem defining vocabulary (DisplayList) for DataGridWidget




problem defining vocabulary (DisplayList) for DataGridWidget
country flaguser name
Canada
2007-04-16 14:02:12
I'm trying to add a drop-down to populate a column in one of
my DataGrid 
tables.

      DataGridField('Recommendation',
         searchable = True,
         columns=("column1", "column2",
"selection"),
         widget = DataGridWidget(
            columns={
               'column1' : Column("Number"),
               'column2' :
Column("Recommendation"),
               'selection' : SelectColumn("Quality
Indicator", 
vocabulary="QUAL_IND")
            },     
         ),     
      ),

I've tried two things.
1) pull/import the data from my config.py with the following
statement 
in it:
QUAL_IND = DisplayList((
    ('high', 'High Q'),
    ('normal', 'Normal Q'),
    ('low', 'Low Q'),
    ))

This method works with a SelectionWidget, but not with the 
DataGridWidget and the SelectColumn.  With the latter, when
I open it 
for edit with the following statement in my DataGridWidget
'selection' : SelectColumn("Quality Indicator",
vocabulary="QUAL_IND")
I get an error after I restart zope and try to create a new
document of 
that type:
Error Type
    AttributeError
Error Value
    Class is missing vocabulary function QUAL_IND

2) If, instead, I try to add it to my class declaration,
with:
def QUAL_IND(self):
                return DisplayList(
                    (("high", "High
Q",),
                    ("normal", "Normal
Q",)
                    ("low", "Low
Q",),))

My document type is no longer shown under the Add menu,
after I restart 
zope.  In fact, any def statement make the document become
unavailable.

Would anyone be able to offer advice or point me to the
right document.

I believe that I import all that is required:

from Products.Archetypes.utils import DisplayList
from Products.WPDoc.config import QUAL_IND
from Products.DataGridField import DataGridField,
DataGridWidget
from Products.DataGridField.Column import Column
from Products.DataGridField.SelectColumn import
SelectColumn

Jean

------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Plone-Users mailing list
Plone-Userslists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-users


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )