Datamanager2 tabledata datatype is for handling easily table data.

Aside form the regular storage modes, tabledata can also work with m:n relation-type data: If you have an object connected to multiple objects of another class via an extended mapping table, the mapping table entries can be displayed as rows.

Example: If a customer in a web shop orders a few items from the catalog, his order will likely be placed in a mapping table which contains the ordered amount and other data and links to the user object and the respective product object.

This code adds a widget to an edit account form which displays the ordered items as rows and the order information (quantity and so on) as columns:

'orders' => Array ( 'title' => 'My Orders', 'description' => '', 'helptext' => '', 'type_config' => Array ( 'print_row_names' => true, 'sortable_columns' => false, 'sortable_rows' => false, 'storage_mode' => 'link', 'link_class' => 'orders_dba', 'link_parent_field' => 'user', 'link_parent_type' => 'id', 'link_columns' => Array('quantity', 'shipping', 'notes'), 'link_row_property' => 'product', 'link_row_class' => 'product_dba', 'link_row_title_field' => 'product_title', ), 'type' => 'tabledata', 'widget' => 'tabledata',

 ),
package midcom.helper.datamanager2

 Methods

_on_initialize ()

Add JavaScript files if requested

Returns

booleanIndicating success

convert_from_csv ($source)

Parameters

$source

convert_from_storage (String $source)

Convert the data from storage

Parameters

$source

Stringsource

convert_to_csv ()

convert_to_html ()

HTML output

Returns

StringOutput string

convert_to_storage ()

Convert the data to storage

get_existing_columns ()

Get the existing columns in the correct order

Returns

Arraycontaining column details as key => name pairs

get_existing_rows ()

Get the existing rows.

Returns

Arraycontaining row information

get_row (String $row)

Get row by its ID

Parameters

$row

StringRow identifier

Returns

mixedArray containing columns and values as key => value pairs or false on failure

get_table_data ()

Get the whole table

Returns

Arraycontaining values

get_value (String $row, String $column)

Get the value of a single cell

Parameters

$row

StringRow name

$column

StringColumn name

_load_parameter_rows ()

_load_rows ()

_store_parameters ()

 Properties

 

Array $_column_order

Column sort order
access protected
 

Array $_original_columns

Safety for the original columns
 

Array $_remove_columns

List of columns that shall be removed
 

Array $_row_order

Row sort order
access protected
 

Array $_storage_data

Storage data or the data that should be stored
access protected
 

boolean $allow_column_rename

Should the column renaming be enabled
 

boolean $allow_new_columns

Should adding new columns be allowed?
 

boolean $allow_new_rows

Allow creation of new rows
 

integer $column_limit

Maximum number of columns
 

Array $columns

Column header data
               

String $parameter_domain

Parameter domain that will be used to store the data
 

boolean $print_row_names

Should the row names be printed?
 

String $row_limit

Maximum amount of rows
 

String $row_sort_order

Row sort order
 

Array $rows

Row header data
 

boolean $sortable_columns

Allow sorting of the columns
 

boolean $sortable_rows

Allow sorting of the rows
 

String $storage_mode

Storage mode determines how the information is stored
 

String $storage_mode_parameter_limiter

Storage mode 'parameter' limiter
 

integer $_row_count

How many rows have been printed