Class TableField
TableField behaves in the same manner as TableListField, however allows the addition of fields and editing of attributes specified, and filtering results.
Caution: If you insert DropdownFields in the fieldTypes-array, make sure they have an empty first option. Otherwise the saving can't determine if a new row should really be saved.
Caution: TableField relies on {@FormResponse} to reload the field after it is saved. A TableField-instance should never be saved twice without reloading, because otherwise it can't determine if a field is new (=create) or existing (=update), and will produce duplicates.
- Object
-
ViewableData
implements
IteratorAggregate
-
RequestHandler
-
FormField
-
TableListField
-
TableField
Param: $name string The fieldname
Param: $sourceClass string The source class of this field
Param: $fieldList array An array of field headings of Fieldname => Heading Text (eg. heading1)
Param: $fieldTypes array An array of field types of fieldname => fieldType (eg. formfield). Do not use for extra data/hiddenfields.
Param: $filterField string The field to filter by. Give the filter value in $sourceFilter. The value will automatically be set on new records.
Param: $sourceFilter string If $filterField has a value, then this is the value to filter by. Otherwise, it is a SQL filter expression.
Param: $editExisting boolean (Note: Has to stay on this position for legacy reasons)
Param: $sourceSort string
Param: $sourceJoin string
Located at sapphire/forms/TableField.php
Methods summary
public
|
#
__construct(
Create a new field. |
public
|
|
public
integer
|
|
public
|
#
Items( )
Displays the items from |
protected
|
#
generateTableFieldItem(
Generates a new |
public
array
|
|
public
|
|
public
|
#
FieldSetForRow( )
Get all |
public
|
|
public
|
|
public
mixed
|
|
public
array
|
#
saveData(
Called on save, it creates the appropriate objects and writes them to the database. |
public
array
|
|
public
|
|
public
array
|
|
public
|
|
public
|
|
public
|
|
public
|
#
jsValidation( )
javascript handler Functions for each field type by default formfield doesnt have a validation function |
public
|
|
public
|
|
public
|
|
public
|
|
public
boolean
|
Methods inherited from TableListField
Actions(),
BaseLink(),
Can(),
CurrentLink(),
ExportLink(),
FirstItem(),
FirstLink(),
GroupedItems(),
HasGroupedItems(),
HasSummary(),
LastItem(),
LastLink(),
ListStart(),
Name(),
NamePlural(),
NameSingular(),
NextLink(),
PageSize(),
PrevLink(),
PrintLink(),
ShowPagination(),
SummaryFields(),
SummaryTitle(),
Title(),
TotalCount(),
Utility(),
addSummary(),
ajax_refresh(),
colFunction_avg(),
colFunction_sum(),
delete(),
disableSorting(),
export(),
filterString(),
generateExportFileData(),
getCastedValue(),
getCsvQuery(),
getCsvSeparator(),
getExtraLinkParams(),
getPermissions(),
getQuery(),
handleItem(),
index(),
isFieldSortable(),
permissions_for_object(),
printall(),
removeCsvHeader(),
removeSummary(),
setCSVFieldFormatting(),
setClick_AjaxLoad(),
setClick_PopupLoad(),
setCsvSeparator(),
setCustomCsvQuery(),
setCustomQuery(),
setCustomSourceItems(),
setExtraLinkParams(),
setFieldCasting(),
setFieldFormatting(),
setFieldList(),
setFieldListCsv(),
setHighlightConditions(),
setPageSize(),
setPermissions(),
setShowPagination(),
setTemplate(),
sourceClass(),
sourceFilter(),
sourceItems()
Methods inherited from FormField
Field(),
LeftTitle(),
Link(),
Message(),
MessageType(),
Required(),
RightTitle(),
SmallFieldHolder(),
Type(),
Value(),
addExtraAttribute(),
addExtraClass(),
allowHTML5(),
allow_html5(),
attrName(),
attrTitle(),
attrValue(),
createTag(),
dataValue(),
debug(),
describe(),
extraClass(),
forTemplate(),
getCustomValidationMessage(),
getForm(),
getTabIndex(),
getTabIndexHTML(),
hasClass(),
hasData(),
id(),
isComposite(),
isDisabled(),
isReadonly(),
name_to_label(),
removeExtraAttribute(),
removeExtraClass(),
rootFieldSet(),
securityTokenEnabled(),
setAutocomplete(),
setContainerFieldSet(),
setCustomValidationMessage(),
setDisabled(),
setError(),
setForm(),
setHTML5Attribute(),
setLeftTitle(),
setName(),
setReadonly(),
setRightTitle(),
setTabIndex(),
setTitle(),
setValue(),
transform(),
useHTML5(),
use_html5()
Methods inherited from RequestHandler
allowedActions(),
checkAccessAction(),
getRequest(),
handleRequest(),
hasAction(),
httpError()
Methods inherited from ViewableData
ATT_val(),
BaseHref(),
CSSClasses(),
ColumnBreak(),
ColumnCalc(),
ColumnNumber(),
ColumnPad(),
ColumnPos(),
CurrentMember(),
CurrentPage(),
Debug(),
Even(),
EvenOdd(),
First(),
FirstLast(),
HasPerm(),
IsAjax(),
JS_val(),
Last(),
Me(),
Middle(),
MiddleString(),
Modulus(),
MultipleOf(),
Odd(),
Pos(),
RAW_val(),
SQL_val(),
ThemeDir(),
ThemeName(),
Top(),
TotalItems(),
XML_val(),
__get(),
__isset(),
__set(),
buildCastingCache(),
cachedCall(),
castingClass(),
castingHelper(),
castingHelperPair(),
castingObjectCreator(),
castingObjectCreatorPair(),
customise(),
defineMethods(),
escapeTypeForField(),
getIterator(),
getSecurityID(),
getXMLValues(),
hasField(),
hasValue(),
i18nLocale(),
iteratorProperties(),
obj(),
renderWith(),
setCustomisedObj(),
setField()
Methods inherited from Object
__call(),
__toString(),
__wakeup(),
addMethodsFrom(),
addStaticVars(),
addWrapperMethod(),
add_extension(),
add_static_var(),
allMethodNames(),
cacheToFile(),
cacheToFileWithArgs(),
clearCache(),
combined_static(),
create(),
createMethod(),
create_from_string(),
exists(),
extInstance(),
extend(),
getCustomClass(),
getExtensionInstance(),
getExtensionInstances(),
get_extensions(),
get_static(),
hasExtension(),
hasMethod(),
has_extension(),
invokeWithExtensions(),
is_a(),
loadCache(),
parentClass(),
parse_class_spec(),
remove_extension(),
sanitiseCachename(),
saveCache(),
set_stat(),
set_static(),
set_uninherited(),
stat(),
strong_create(),
uninherited(),
uninherited_static(),
useCustomClass()
Magic methods summary
Properties summary
protected
mixed
|
$sourceClass | |
protected
mixed
|
$sourceFilter | |
protected
mixed
|
$fieldList | |
protected
mixed
|
$filterField |
#
A "Field = Value" filter can be specified by setting $this->filterField and $this->filterValue. This has the advantage of auto-populating new records |
protected
mixed
|
$filterValue |
#
A "Field = Value" filter can be specified by setting $this->filterField and $this->filterValue. This has the advantage of auto-populating new records |
protected
mixed
|
$fieldTypes |
#
FieldSet Caution: Use {@setExtraData()} instead of manually adding HiddenFields if you want to preset relations or other default data. |
protected
mixed
|
$sourceSort | |
protected
mixed
|
$sourceJoin | |
protected
string
|
$template |
#
string Template-Overrides |
protected
mixed
|
$extraData |
#
array Any extra data that need to be included, e.g. to retain has-many relations. Format: array('FieldName' => 'Value') |
protected
mixed
|
$tempForm | |
protected
array
|
$permissions |
#
Influence output without having to subclass the template. |
public
array
|
$transformationConditions | |
protected
mixed
|
$requiredFields |
#
array Required fields as a numerical array. Please use an instance of Validator on the including form. |
public
boolean
|
$showAddRow |
#
Shows a row of empty fields for adding a new record (turned on by default).
Please use |
protected
boolean
|
$relationAutoSetting |
#
Automatically detect a has-one relationship in the popup (=child-class) and save the relation ID. |
Properties inherited from TableListField
$IsReadOnly,
$Markable,
$MarkableTitle,
$__cachedQuery,
$actions,
$cachedSourceItems,
$clickAction,
$csvFieldEscape,
$csvFieldFormatting,
$csvHasHeader,
$csvSeparator,
$customCsvQuery,
$customQuery,
$customSourceItems,
$defaultAction,
$disableSorting,
$exportButtonLabel,
$extraLinkParams,
$fieldCasting,
$fieldFormatting,
$fieldListCsv,
$groupByField,
$highlightConditions,
$itemClass,
$methodName,
$pageSize,
$paginationBaseLink,
$readOnly,
$showPagination,
$summaryFieldList,
$summaryTitle,
$totalCount,
$url_handlers
Properties inherited from FormField
$autocomplete,
$containerFieldSet,
$customValidationMessage,
$description,
$disabled,
$dontEscape,
$extraAttributes,
$extraClass,
$extraClasses,
$fieldHTML5,
$form,
$html5Attributes,
$leftTitle,
$message,
$messageType,
$name,
$possible_autocomplete_values,
$readonly,
$rightTitle,
$tabIndex,
$title,
$use_html5,
$value
Properties inherited from RequestHandler
$allowed_actions,
$brokenOnConstruct,
$request
Properties inherited from ViewableData
$casting,
$customisedObject,
$default_cast,
$failover,
$iteratorPos,
$iteratorTotalItems