Skip to main content

A table input component for Plone.

Project description

Version 1.6

Released under the GNU General Public License

A table input component for Plone. Uses Javascript to make entering tabular data more user friendly process - there are no round trip HTTP requests to the server when inserting or deleting rows.

Features

o Any number of columns set by a developer

o Any number of rows filled by a user

o Insert and deleting rows without submitting a form

o Many different column types

Requirements

o Plone Plone 2.5.x or Plone 3.0.x

o A browser with Javascript support. There isn’t yet graceful degeneration for

browsers without or disabled Javascript.

Quality

o Tested with Firefox 2.0, IE 6, IE 7

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

o 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

o Sometimes on Firefox column sizes start changing after the user enters some

data. Not sure if this is a Firefox bug, though.

o Prefilled default values work only for text and select columns

o 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”:http://plone.org/products/custom-search/ uses DataGridField for editing search form query fields.

“London School of Marketing”:http://www.londonschoolofmarketing.com site uses DataGridField extensively

Contributors

People who have been making this true:

o Mikko Ohtamaa, “Red Innovation”:http://www.redinnovation.com

o Danny Bloemendaal

o Radim Novotny

o Justin Ryan

o Alexander Limi

o PloneSolutions <info@plonesolutions.com>

o Martin Aspeli <optilude@gmx.net>

o Paul Everitt, Zope Europe Association <paul@zope-europe.org>

o Development was helped by Vincent Bonamy

Original concept and prototype:

o Geir Baekholt, Plone Solutions <info@plonesolutions.com>

o Paul Everitt, Zope Europe Association <paul@zope-europe.org>

Sponsorship

Organizations paying up for the development

o “London School of Marketing”:http://www.londonschoolofmarketing.com

o “United Nations Environment Programme”:http://www.unep.org

From 1.6 beta 3 (unreleased)

  • Eggified in Products.AddRemoveWidget [SteveM]

  • Register skin layer correctly. [maurits]

  • Move installation to GenericSetup. [wichert]

  • Removed lots and lots of unneeded import. Pyflakes found that Plone 2.1 support has been broken for a while, so stop claiming it’s still supported. [wichert]

  • Added validator isDataGridFilled (copied from Poi, where it can later be removed). Use this as validator on a DataGridField if you want it to have at least one entry: currently a bogus/hidden entry always remains even when you remove all real entries, so making a DataGridField required has no real effect. See http://plone.org/products/poi/issues/139 and 160. [maurits]

From 1.6 beta 2

  • Disabled INSTALL_DEMO_TYPES from config.py. Repeat after me: “enable INSTALL_DEMO_TYPES; make changes; run tests; disable INSTALL_DEMO_TYPES; commit” :) [andrewburkhalter]

From 1.5

  • Pop-up help column by Juan Grigera

  • Added CheckboxColumn by Radim Novotny

  • Plone 3.0 compatible (fixed CMFCorePermissions import)

  • Fixed http://plone.org/products/datagridfield/issues/16 (applied the patch)

  • DataGridField has new property allow_oddeven. Setting this to True will highlight odd end even rows in the view/edit tables. Default: False

  • FixedColumn has optional parameter “visible” (default True). Setting this to False will hide (using css) column from both - view and edit forms.

From 1.5 RC 3

  • Added CheckboxColumn. Implementation based on RadioColumn, so there are same bugs. CheckboxColumn lose values if any field on the form raises validation error. Be aware of that, better does not use CheckboxColumn in forms with required fields or fields with validators. [Contributor: naro, radim novotny]

From 1.5 RC 2

  • Fixed row adding in IE. This was one of the most horrible debugging session I have had. There was some obscure IE bug which prevented making a DOM node orignally hidden to visible. I created “hacky” workaround for this. Tested in IE 6.0 and FF 1.5.

  • Wolfram Fenske’s I18N patch is disabled, since it doesn’t work in Plone 2.5. The code is almost there. If someone wants to make it complete, it shouldn’t take too much time.

From 1.5 RC 1

  • Added workaround for bad DGF initializing which caused empty rows when DGF was created programmatically

From 1.0 to 1.5

  • Plone 2.5 compatibility guaranteed

  • DGF row manipulators rewritten. Automatically adding new rows feature is now optional, thus making it possible for columns to have prefilled default values without creating a mess. Disabling auto insert is necessary for columns like SelectWidget which don’t have empty default values.

  • Refactored page template code to be more easily extendable. Now CSS file is used for styling DataGridWidgets.

  • New column type: Link column

  • (Wolfram Fenske) I18N patch

    Archetypes widgets have an attribute i18n_domain, which is used to determine which message catalog to use for translation. In DataGridField, this attribute is ignored.

    I have attached a small patch (in fact, smaller than this bug report) which fixes these problems. I didn’t want to introduce a lot of new code, so I did the translation of the labels in the Column class, not in the page template, which might also have been a good way to do it. Since the functions “getLabel()” and “getColumnLabels()” are only called by the page template anyway, I believe this is not an issue. But if you’d rather translate the labels in the page template, please let me know and I’ll write a different patch.

  • (Juan Grigera) Marshaller patch

    I enjoyed your DataGriedField/Widget product for Plone, and would like to contributea small patch/bugfix. In the field mutator (set) the passed value is not always a record, but sometimes a string. In fact the RFC822Marshaller passes a string.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

Products.DataGridField-1.6b3-py2.4.egg (107.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page