DataGridField
Category: Fields and widgets
—
Other products by this author
Current release: DataGridField 1.5.0
Released Jan 3, 2007 — tested with Plone 2.5.2, Plone 2.1.3
Major production release
Experimental releases
Upcoming and alpha/beta/candidate releases
- Alpha releases should only be used for testing and development.
- Beta releases and Release Candidates are normally released for production testing, but should not be used on mission-critical sites.
- Always install on a separate test server first, and make sure you have proper backups before installing.
Release roadmap for DataGridField…
Project Description
- Project resources
DataGridField
Released under the GNU General Public License
Features
- Any number of columns set by a developer
- Any number of rows filled by a user
- Insert and deleting rows without submitting a form
- Many different column types
Requirements
- A browser with Javascript support. There isn't yet graceful degeneration for browsers without or disabled Javascript.
Quality
- Tested with Firefox 2.0, IE 6
Usage examples
Simple example with three free text columns:
schema = BaseSchema + Schema((
DataGridField('DemoField',
widget = DataGridWidget(),
columns=('column1','column2','The third')
),
))
Complex example with different column types and user friendly labels:
# Plone imports
from Products.Archetypes.public import DisplayList
from Products.Archetypes.public import *
# Local imports
from Products.DataGridField import DataGridField, DataGridWidget
from Products.DataGridField.Column import Column
from Products.DataGridField.SelectColumn import SelectColumn
class DataGridDemoType(BaseContent):
"""A simple archetype
"""
schema = BaseSchema + Schema((
DataGridField('DemoField',
searchable = True,
columns=("column1", "column2", "select_sample"),
widget = DataGridWidget(
columns={
'column1' : Column("Toholampi city rox"),
'column2' : Column("My friendly name"),
'select_sample' : SelectColumn("Friendly name", vocabulary="getSampleVocabulary")
},
),
),
))
def getSampleVocabulary(self):
"""
"""
""" Get list of possible taggable features from ATVocabularyManager """
return DisplayList(
(("sample", "Sample value 1",),
("sample2", "Sample value 2",),))
For more examples, see unit test code.
Notes
- Since DataGridField 1.5, if you wish to retain old way of automatic row inserting. Here is a bit logic behind all this - otherwise there will be an extra row added when you edit DGF and press save. o You must set property auto_insert = True to DataGridWidget o You must set property allow_empty_rows = False to DataGridField
Known features
- Sometimes on Firefox column sizes start changing after the user enters some data. Not sure if this is a Firefox bug, though.
- Prefilled default values work only for text and select columns
- Radio button and link column postback is not handled propeply. This needs fixes to very deep into Zope (ZPublisher). If the form validation fails, link column and radio button columns lost their values.
Demo
A demo type is included. Set INSTALL_DEMO_TYPES = True in config.py to enable it. It is disabled by default. This type is neither pretty nor very functional, but demonstrates how a data grid should be used. Also, to run unit tests, you need to set this variable. I couldn't come up with a nice hack which would tell config.py whether it's imported from unit testing framework or not.
References
Custom Search product uses DataGridField for editing search form query fields.
London School of Marketing site uses DataGridField extensively
Contributors
People who have been making this true:
- Mikko Ohtamaa, Red Innovation
- Danny Bloemendaal
- Radim Novotny
- Justin Ryan
- Alexander Limi
- Jarn
- Martin Aspeli
- Paul Everitt, Zope Europe Association
- Development was helped by Vincent Bonamy
Original concept and prototype:
- Geir Bækholt, Jarn < info@jarn.com >
- Paul Everitt, Zope Europe Association < paul@zope-europe.org >
Sponsorship
Organizations paying up for the development