﻿DataGridField
Version 1.5
Released under the GNU General Public License

An AJAX table component for Plone. Uses Javascript to make entering tabular data more user friendly process - no round up HTTP requests to the server.

**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 (here AJAX kicks in)

o Many different column types

**Requirements**

o Plone 2.1.3 or Plone 2.5.x

o A browser with Javascript support. There isn't yet graceful degeneration for 
  browsers without or disabled Javascript.

**Quality**

o Tested with Firefox 1.5, IE 6, Opera 9.x on Windows
  
**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 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 (Oulu, Finland) < "mikko@redinnovation.com":mailto:mikko@redinnovation.com >  

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 Bækholt, 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






