phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
DataTable Class Reference

DataTable widget for displaying list of objects. More...

+ Inheritance diagram for DataTable:

Public Member Functions

 __construct ($identifier, $model, $modelInstance=NULL)
 
 run (JsUtils $js)
 
Parameters
JsUtils$js
Returns
SimpleExtComponent
See also
\Ajax\common\html\BaseHtmlrun()
See also
\Ajax\common\html\BaseHtmlrun()
See also
\Ajax\common\html\BaseHtmlrun()

 
 refreshTR ()
 
 refreshTD ($fieldName, $jquery, $view)
 
 compile (JsUtils $js=NULL, &$view=NULL)
 
 getFieldValue ($index)
 
 afterCompile ($index, $callback)
 Associates a $callback function after the compilation of the field at $index position The $callback function can take the following arguments : $field=>the compiled field, $instance : the active instance of the object, $index: the field position.
 
 getHtmlComponent ()
 {}
 
 getUrls ()
 
 setUrls ($urls)
 Sets the associative array of urls for refreshing, updating or deleting think of defining the update zone with the setTargetSelector method.
 
 paginate ($page, $total_rowcount, $items_per_page=10, $pages_visibles=null)
 Paginates the DataTable element with a Semantic HtmlPaginationMenu component.
 
 autoPaginate ($page=1, $items_per_page=10, $pages_visibles=4)
 Auto Paginates the DataTable element with a Semantic HtmlPaginationMenu component.
 
 refresh ($compileParts=['tbody'])
 
 addSearchInToolbar ($position=Direction::RIGHT)
 Adds a search input in toolbar.
 
 getSearchField ()
 
 onNewRow ($callback)
 The callback function called after the insertion of each row when fromDatabaseObjects is called callback function takes the parameters $row : the row inserted and $object: the instance of model used.
 
 asForm ()
 Returns a form corresponding to the Datatable.
 
 setTargetSelector ($_targetSelector)
 Sets the response element selector for Edit and Delete request with ajax.
 
 getRefreshSelector ()
 
 setRefreshSelector ($_refreshSelector)
 
 show ($modelInstance)
 {}
 
 getRowClass ()
 
 setRowClass ($_rowClass)
 Sets the default row class (tr class)
 
 setEmptyMessage ($_emptyMessage)
 Sets the message displayed when there is no record.
 
 setSortable ($colIndex=NULL)
 
 setActiveRowSelector ($class="active", $event="click", $multiple=false)
 
 getActiveRowClass ()
 
 hasActiveRowSelector ()
 
 hideColumn ($colIndex)
 
 setColWidth ($colIndex, $width)
 
 setColWidths ($_colWidths)
 
 setColAlignment ($colIndex, $alignment)
 
 trigger ($event, $params="[]")
 
 onActiveRowChange ($jsCode)
 
 getDeleteBehavior ()
 
 getEditBehavior ()
 
 getDisplayBehavior ()
 
 setDisplayBehavior ($_displayBehavior)
 
 getGroupByFields ()
 
 setGroupByFields ($_groupByFields)
 
 addGroupBy ($index)
 
 setVisibleHover ($_visibleHover)
 
 getPaginationToolbar ()
 
 setInverted ($recursive=true)
 can be formatted to appear on dark backgrounds
 
 setFocusable (bool $focusable)
 
 setFormCaption ($caption)
 
 getNamePrefix ()
 
 setNamePrefix ($namePrefix)
 
- Public Member Functions inherited from Widget
 getModel ()
 
 setModel ($_model)
 
 getInstanceViewer ()
 
 setInstanceViewer ($_instanceViewer)
 
 setAttached ($value=true)
 
 setColor ($color)
 
 setCaptions ($captions)
 
 setCaption ($index, $caption)
 
 setFields ($fields)
 
 addField ($field, $key=null)
 
 addFields ($fields)
 
 countFields ()
 
 addMessage ($attributes=NULL, $fieldName="message")
 
 addErrorMessage ()
 
 insertField ($index, $field, $key=null)
 
 insertInField ($index, $field, $key=null)
 
 setValueFunction ($index, $callback)
 Defines the function which displays the field value.
 
 setIdentifierFunction ($callback)
 
 getToolbar ()
 
 addInToolbar ($element, $callback=NULL)
 Adds a new element in toolbar.
 
 addItemInToolbar ($caption, $icon=NULL, $callback=NULL)
 
 addItemsInToolbar (array $items, $callback=NULL)
 
 addDropdownInToolbar ($value, $items, $callback=NULL)
 
 addButtonInToolbar ($caption, $cssStyle=null, $callback=NULL)
 
 addButtonsInToolbar (array $captions, $asIcon=false, $callback=NULL)
 
 addLabelledIconButtonInToolbar ($caption, $icon, $before=true, $labeled=false)
 
 addSubmitInToolbar ($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL)
 
 setCaptionCallback ($captionCallback)
 Defines a callback function to call for modifying captions function parameters 0are.
 
 setEdition ($_edition=true)
 Makes the input fields editable.
 
 setDefaultValueFunction ($defaultValueFunction)
 Defines the default function which displays fields value.
 
 getDefaultValueFunction ()
 
 jsDisabled ($disable=true)
 
 addEditButtonInToolbar ($caption, $callback=NULL)
 
 setToolbar (HtmlMenu $_toolbar)
 
 setToolbarPosition ($_toolbarPosition)
 
 getForm ()
 
 setValidationParams (array $_validationParams)
 Sets the parameters for the Form validation (on, inline, delay...)
 
 moveFieldTo ($from, $to)
 
 swapFields ($index1, $index2)
 
 removeField ($index)
 
 asModal ($header=null)
 
 addToProperty ($name, $value, $separator=" ")
 
 getModelInstance ()
 
 hasRules ()
 
- Public Member Functions inherited from HtmlDoubleElement
 __construct ($identifier, $tagName="p")
 
 setContent ($content)
 
 getContent ()
 
 addContent ($content, $before=false)
 
 setValue ($value)
 
 wrapContent ($before, $after="")
 
 wrapWith (HtmlDoubleElement $container)
 Wraps the element with a container.
 
 getContentInstances ($class)
 
 asLink ($href=NULL, $target=NULL)
 Transforms the element into a link.
 
 getTextContent ()
 
 asEditable (HtmlFormField $field, $asForm=false, $setValueProperty="val()")
 
- Public Member Functions inherited from HtmlSingleElement
 setClass ($classNames)
 
 addClass ($classNames)
 
 setRole ($value)
 
 setTitle ($value)
 
 setStyle ($value)
 
 fromArray ($array)
 
 setSize ($size)
 
- Public Member Functions inherited from BaseHtml
 getTagName ()
 
 setTagName ($tagName)
 
 fromDatabaseObjects ($objects, $function)
 
 fromDatabaseObject ($object, $function)
 
 wrap ($before, $after="")
 
 getElementById ($identifier, $elements)
 
 getBsComponent ()
 
 setBsComponent ($bsComponent)
 
 setDraggable ($attr="id", $dropZone=null, $parameters=[])
 Sets the element draggable, and eventualy defines the dropzone (HTML5 drag and drop)
 
 asDropZone ($jsCallback="", $jqueryDone="append", $parameters=[])
 Declares the element as a drop zone (HTML5 drag and drop)
 
 asFileDropZone ($responseElement=null, $url=null, $progress=null, $jsCallback="", $parameters=[])
 Declares the element as a drop zone for file uploading (HTML5 drag and drop)
 
 __toString ()
 
 onPostCompile ($callback)
 
 onPreCompile ($callback)
 
- Public Member Functions inherited from BaseWidget
 __construct ($identifier)
 
 getIdentifier ()
 
 setIdentifier ($identifier)
 
 getLibraryId ()
 
 setLibraryId ($_libraryId)
 
- Public Member Functions inherited from BaseHtmlEventsTrait
 addEvent ($event, $jsCode, $stopPropagation=false, $preventDefault=false)
 
 jsTrigger ($event, $params="[this]")
 
 _addEvent ($event, $jsCode)
 
 on ($event, $jsCode, $stopPropagation=false, $preventDefault=false)
 
 onClick ($jsCode, $stopPropagation=false, $preventDefault=true)
 
 setClick ($jsCode)
 
 onCreate ($jsCode)
 
 addEventsOnRun (JsUtils $js=NULL)
 
 _ajaxOn ($operation, $event, $url, $responseElement="", $parameters=array())
 
 getOn ($event, $url, $responseElement="", $parameters=array())
 Performs a get to $url on the event $event on $element and display it in $responseElement.
 
 getOnClick ($url, $responseElement="", $parameters=array())
 Performs a get to $url on the click event on $element and display it in $responseElement.
 
 postOn ($event, $url, $params="{}", $responseElement="", $parameters=array())
 Performs a post to $url on the event $event on $element and display it in $responseElement.
 
 postOnClick ($url, $params="{}", $responseElement="", $parameters=array())
 Performs a post to $url on the click event on $element and display it in $responseElement.
 
 postFormOn ($event, $url, $form, $responseElement="", $parameters=array())
 Performs a post form with ajax.
 
 postFormOnClick ($url, $form, $responseElement="", $parameters=array())
 Performs a post form with ajax on click.
 
 jsDoJquery ($jqueryCall, $param="")
 
 executeOnRun ($jsCode)
 
 jsHtml ($content="")
 
 jsShow ()
 
 jsHide ()
 
 jsToggle ($value)
 
 getEvents ()
 
- Public Member Functions inherited from BaseHtmlPropertiesTrait
 getProperties ()
 
 setProperties ($properties)
 
 setProperty ($name, $value)
 
 getProperty ($name)
 
 addProperties ($properties)
 
 removePropertyValue ($name, $value)
 
 addToPropertyCtrl ($name, $value, $typeCtrl)
 
 addToPropertyCtrlCheck ($name, $value, $typeCtrl)
 
 removeProperty ($name)
 
 propertyContains ($propertyName, $value)
 
- Public Member Functions inherited from FieldAsTrait
 setPropertyValues ($property, $indexValues)
 Defines the values for the fields for a property (or html attribute).
 
 fieldAsProgress ($index, $label=NULL, $attributes=array())
 
 fieldAsRating ($index, $max=5, $icon="")
 
 fieldAsLabel ($index, $icon=NULL, $attributes=NULL)
 
 fieldAsHeader ($index, $niveau=1, $icon=NULL, $attributes=NULL)
 
 fieldAsImage ($index, $size=Size::MINI, $circular=false)
 
 fieldAsFlag ($index)
 
 fieldAsIcon ($index)
 
 fieldAsAvatar ($index, $attributes=NULL)
 
 fieldAsRadio ($index, $attributes=NULL)
 
 fieldAsRadios ($index, $elements=[], $attributes=NULL)
 
 fieldAsList ($index, $classNames="", $attributes=NULL)
 
 fieldAsInput ($index, $attributes=NULL)
 
 fieldAsLabeledInput ($index, $attributes=NULL)
 
 fieldAsDataList ($index, ?array $items=[], $attributes=NULL)
 
 fieldAsFile ($index, $attributes=NULL)
 
 fieldAsTextarea ($index, $attributes=NULL)
 
 fieldAsElement ($index, $tagName="div", $baseClass="", $attributes=NULL)
 
 fieldAsHidden ($index, $attributes=NULL)
 
 fieldAsCheckbox ($index, $attributes=NULL)
 
 fieldAsDropDown ($index, $elements=[], $multiple=false, $attributes=NULL)
 
 fieldAsMessage ($index, $attributes=NULL)
 
 fieldAsLink ($index, $attributes=NULL)
 
 fieldsAs (array $types)
 Change fields type.
 
 fieldAs ($index, $type, $attributes=NULL)
 
 fieldAsSubmit ($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL)
 
 fieldAsButton ($index, $cssStyle=NULL, $attributes=NULL)
 
 fieldAsDataTable ($index, $model, $instances=null, $fields=[], $attributes=NULL)
 
- Public Member Functions inherited from FormTrait
 setLoading ()
 
 setState ($state)
 
 jsState ($state)
 
 submitOn ($event, $identifierOrElement, $url, $responseElement, $parameters=NULL)
 
 submitOnClick ($identifier, $url, $responseElement, $parameters=NULL)
 
 addSubmit ($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL)
 
 setSubmitParams ($url, $responseElement=NULL, $parameters=NULL)
 
 addReset ($identifier, $value, $cssStyle=NULL)
 
 onValid ($jsCode)
 Callback on each valid field.
 
 onSuccess ($jsCode)
 Callback if a form is all valid.
 
 addExtraFieldRules ($fieldname, $rules)
 
 addExtraFieldRule ($fieldname, $type, $prompt=NULL, $value=NULL)
 
 setOptional ($fieldname, $optional=true)
 
 setActionTarget (string $action, string $target)
 
- Public Member Functions inherited from BaseHooksTrait
 hookExists ($hookKey)
 
 getHook ($hookKey)
 
 addHook ($hookKey, $callable)
 Adds a new Hook.
 
 execHook ($hookKey,... $variables)
 Executes the hook with key $hookKey.
 
- Public Member Functions inherited from TableTrait
 addEvent ($event, $jsCode, $stopPropagation=false, $preventDefault=false)
 
 getOn ($event, $url, $responseElement="", $parameters=array())
 
 setCelled ()
 
 setBasic ($very=false)
 
 setCompact ($very=false)
 
 setCollapsing ()
 
 setDefinition ()
 
 setStructured ()
 
 setSingleLine ()
 
 setFixed ()
 
 setSelectable ()
 
 setStriped ()
 
 onRowClick ($jsCode, $stopPropagation=false, $preventDefault=false)
 
 onRow ($event, $jsCode, $stopPropagation=false, $preventDefault=false)
 
 getOnRow ($event, $url, $responseElement="", $parameters=array())
 
 onPageChange ($jsCode)
 
 onSearchTerminate ($jsCode)
 
 getEventsScript ()
 
 addEventsOnRun (JsUtils $js=NULL)
 
- Public Member Functions inherited from DataTableFieldAsTrait
 addField ($field, $key=null)
 
 insertField ($index, $field, $key=null)
 
 insertInField ($index, $field, $key=null)
 
 fieldAs ($index, $type, $attributes=NULL)
 
 fieldAsSubmit ($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL)
 Creates a submit button at $index position.
 
 addFieldButton ($caption, $visibleHover=true, $callback=null)
 Inserts a new Button for each row.
 
 addFieldButtons ($buttons, $visibleHover=true, $callback=null)
 Inserts a new ButtonGroups for each row.
 
 insertFieldButton ($index, $caption, $visibleHover=true, $callback=null)
 Inserts a new Button for each row at col $index.
 
 insertInFieldButton ($index, $caption, $visibleHover=true, $callback=null, $key=null)
 Inserts a new Button for each row in col at $index.
 
 addDefaultButton ($icon, $class=null, $visibleHover=true, $callback=null, $key=null)
 
 insertDefaultButtonIn ($index, $icon, $class=null, $visibleHover=true, $callback=null, $key=null)
 
 addDeleteButton ($visibleHover=true, $deleteBehavior=[], $callback=null)
 Adds a delete button.
 
 addEditButton ($visibleHover=true, $editBehavior=[], $callback=null)
 Adds an edit button.
 
 addDisplayButton ($visibleHover=true, $displayBehavior=[], $callback=null)
 Adds a button for displaying an object.
 
 addEditDeleteButtons ($visibleHover=true, $behavior=[], $callbackEdit=null, $callbackDelete=null)
 Adds an edit and a delete button.
 
 addAllButtons ($visibleHover=true, $behavior=[], $callbackDisplay=null, $callbackEdit=null, $callbackDelete=null)
 Adds an edit and a delete button.
 
 insertDeleteButtonIn ($index, $visibleHover=true, $deleteBehavior=[], $callback=null)
 
 insertEditButtonIn ($index, $visibleHover=true, $editBehavior=[], $callback=null)
 
 insertDisplayButtonIn ($index, $visibleHover=true, $displayBehavior=[], $callback=null)
 
 getButtonsColumn ()
 
 setButtons ($_buttons)
 
 getButtons ()
 
- Public Member Functions inherited from HasCheckboxesTrait
 addInToolbar ($element, $callback=NULL)
 
 getHasCheckboxes ()
 
 setHasCheckboxes ($_hasCheckboxes)
 
 setCheckedMessage (array $_checkedMessage)
 Defines the message displayed when checkboxes are checked or unchecked with an associative array 0=>no selection,1=>one item selected, other=>{count} items selected.
 
 addCountCheckedInToolbar (array $checkedMessage=null, $callback=null)
 
 setCheckedClass ($_checkedClass)
 
 setCheckedCallback ($checkedCallback)
 Set the callback function that determines whether the checkbox should be checked for an object.
 
- Public Member Functions inherited from BaseTrait
 addToProperty ($name, $value, $separator=" ")
 
 setProperty ($name, $value)
 
 addContent ($content, $before=false)
 
 onCreate ($jsCode)
 
 addVariation ($variation)
 
 addState ($state)
 
 setVariation ($variation)
 
 setVariations ($variations)
 
 setState ($state)
 
 addVariations ($variations=array())
 
 addStates ($states=array())
 
 setStates ($states)
 
 addIcon ($icon, $before=true)
 
 addSticky ($context="body")
 
 setSize ($size)
 
 setDisabled ($disable=true)
 show it is currently unable to be interacted with
 
 setColor ($color)
 
 setFluid ()
 
 asHeader ()
 
 setActive ($value=true)
 show it is currently the active user selection
 
 setAttached ($value=true)
 
 setCircular ()
 
 setFloated ($direction="right")
 
 floatRight ()
 
 floatLeft ()
 
 getBaseClass ()
 
 getVariations ()
 
 getStates ()
 

Protected Member Functions

 _generateBehavior ($op, $params, JsUtils $js)
 
 getTable ()
 {}
 
 compileExtraElements ($table, $captions)
 
 _applyStyleAttributes ($table)
 
 _hideColumns ()
 
 _generateHeader (HtmlTable $table, $captions)
 
 _generateContent ($table)
 
 _generateGroupByRow ($index, $gbField, $table, $fields, &$activeValues, &$uuids)
 
 _generateRow ($instance, $fields, &$table, $checkedClass=null, $uuids=null)
 
 _generatePagination ($table)
 
 _associatePaginationBehavior (JsUtils $js=NULL, $offset=null)
 
 _compileSearchFieldBehavior (JsUtils $js=NULL)
 
 _associateSearchFieldBehavior (JsUtils $js=NULL, $offset=null)
 
 _getFieldName ($index)
 
 _getFieldCaption ($index)
 
 applyToolbarPosition (string $position, $table, $captions=NULL)
 
 _setToolbarPosition ($table, $captions=NULL)
 
 getTargetSelector ($op)
 
- Protected Member Functions inherited from Widget
 _init ($instanceViewer, $contentKey, $content, $edition)
 
 _getIndex ($fieldName)
 
 _getFieldIdentifier ($prefix, $name="")
 
 runForm (JsUtils $js)
 
 _compileForm ()
 
- Protected Member Functions inherited from HtmlDoubleElement
 _getContentInstances ($class, $content)
 
 compile_once (\Ajax\JsUtils $js=NULL, &$view=NULL)
 {}
 
- Protected Member Functions inherited from BaseHtml
 getTemplate (JsUtils $js=NULL, $view=null)
 
 ctrl ($name, $value, $typeCtrl)
 
 setMemberCtrl (&$name, $value, $typeCtrl)
 
 addToMemberUnique (&$name, $value, $typeCtrl, $separator=" ")
 
 addToMemberCtrl (&$name, $value, $typeCtrl, $separator=" ")
 
 addToMember (&$name, $value, $separator=' ')
 
 removeOldValues (&$oldValue, $allValues)
 
 _getElementBy ($callback, $elements)
 
 setWrapBefore ($wrapBefore)
 
 setWrapAfter ($wrapAfter)
 
 compile_once (JsUtils $js=NULL, &$view=NULL)
 
- Protected Member Functions inherited from BaseWidget
 cleanIdentifier ($id)
 
- Protected Member Functions inherited from BaseHtmlEventsTrait
 _eventsOnCreate (JsUtils $js=NULL)
 
- Protected Member Functions inherited from BaseHtmlPropertiesTrait
 removePropertyValues ($name, $values)
 
 addToPropertyUnique ($name, $value, $typeCtrl)
 
 setPropertyCtrl ($name, $value, $typeCtrl)
 
 getElementByPropertyValue ($propertyName, $value, $elements)
 
- Protected Member Functions inherited from FieldAsTrait
 _buttonAsSubmit (BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL)
 
 _applyAttributes (BaseHtml $element, &$attributes, $index, $instance=null)
 
 _addRules (HtmlFormField $element, &$attributes)
 
 _prepareFormFields (HtmlFormField &$field, $name, &$attributes)
 
 _fieldAs ($elementCallback, &$index, $attributes=NULL, $prefix=null)
 
- Protected Member Functions inherited from FormTrait
 addCompoValidation (Form $compo, HtmlFormField $field)
 
 addExtraCompoValidation (Form $compo, FieldValidation $validation)
 
 _runValidationParams (Form &$compo, JsUtils $js=NULL)
 
 _compileAjaxSubmit ($ajaxSubmit, JsUtils $js=null)
 
 _buttonAsSubmit (BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL)
 
- Protected Member Functions inherited from TableTrait
 addToPropertyTable ($property, $value)
 
- Protected Member Functions inherited from DataTableFieldAsTrait
 cleanIdentifier ($id)
 
 _fieldAs ($elementCallback, &$index, $attributes=NULL, $prefix=null)
 
 _visibleOver (BaseHtml $element)
 
- Protected Member Functions inherited from HasCheckboxesTrait
 _runCheckboxes (JsUtils $js)
 
 _getCheckedChange (JsUtils $js=NULL)
 
 _getCheckedMessageFunction ()
 
 _getCheckedMessageCall (JsUtils $js=NULL)
 
 _generateMainCheckbox (&$captions)
 
 _setAllChecked ($checked)
 
 getCheckedMessage ()
 
- Protected Member Functions inherited from BaseTrait
 setPropertyCtrl ($name, $value, $typeCtrl)
 
 addToPropertyCtrl ($name, $value, $typeCtrl)
 
 addToPropertyCtrlCheck ($name, $value, $typeCtrl)
 
 addBehavior (&$array, $key, $value, $before="", $after="")
 

Protected Attributes

 $_searchField
 
 $_urls
 
 $_pagination
 
 $_compileParts
 
 $_deleteBehavior
 
 $_editBehavior
 
 $_displayBehavior
 
 $_visibleHover = false
 
 $_targetSelector
 
 $_refreshSelector
 
 $_emptyMessage
 
 $_json
 
 $_rowClass = "_element"
 
 $_sortable
 
 $_hiddenColumns
 
 $_colWidths
 
 $_paginationToolbar
 
 $_caption
 
 $_namePrefix
 
- Protected Attributes inherited from Widget
 $_model
 
 $_modelInstance
 
 $_instanceViewer
 
 $_toolbar
 
 $_toolbarPosition
 
 $_edition
 
 $_form
 
 $_generated
 
 $_runned
 
 $_hasRules
 
- Protected Attributes inherited from HtmlDoubleElement
 $content
 
 $wrapContentBefore = ""
 
 $wrapContentAfter = ""
 
 $_editableContent
 
- Protected Attributes inherited from BaseHtml
 $_template
 
 $tagName
 
 $_wrapBefore = array()
 
 $_wrapAfter = array()
 
 $_bsComponent
 
 $_compiled = false
 
 $_runned = false
 
 $_postCompile
 
 $_preCompile
 
- Protected Attributes inherited from BaseWidget
 $identifier
 
 $_identifier
 
 $_libraryId
 
 $_self
 
- Protected Attributes inherited from BaseHtmlEventsTrait
 $_events =array ()
 
- Protected Attributes inherited from BaseHtmlPropertiesTrait
 $properties =array ()
 
- Protected Attributes inherited from BaseHooksTrait
 $_hooks =[]
 
- Protected Attributes inherited from DataTableFieldAsTrait
 $_buttons =["display","edit","delete"]
 
 $_buttonsColumn
 
- Protected Attributes inherited from HasCheckboxesTrait
 $_hasCheckboxes
 
 $_hasCheckedMessage =false
 
 $_checkedMessage
 
 $_checkedClass
 
 $_checkedCallback
 
- Protected Attributes inherited from BaseTrait
 $_variations =[ ]
 
 $_states =[ ]
 
 $_baseClass
 

Private Member Functions

 getElementContent ($elm)
 
 addToolbarRow ($part, $table, $captions)
 

Detailed Description

DataTable widget for displaying list of objects.

Version
1.1.3
Author
jc
Since
2.2

Definition at line 27 of file DataTable.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $identifier,
  $model,
  $modelInstance = NULL 
)

Reimplemented from Widget.

Reimplemented in JsonDataTable.

Definition at line 67 of file DataTable.php.

Member Function Documentation

◆ _applyStyleAttributes()

_applyStyleAttributes (   $table)
protected

Definition at line 190 of file DataTable.php.

◆ _associatePaginationBehavior()

_associatePaginationBehavior ( JsUtils  $js = NULL,
  $offset = null 
)
protected

Reimplemented in JsonDataTable.

Definition at line 332 of file DataTable.php.

◆ _associateSearchFieldBehavior()

_associateSearchFieldBehavior ( JsUtils  $js = NULL,
  $offset = null 
)
protected

Reimplemented in JsonDataTable.

Definition at line 362 of file DataTable.php.

◆ _compileSearchFieldBehavior()

_compileSearchFieldBehavior ( JsUtils  $js = NULL)
protected

Reimplemented in JsonDataTable.

Definition at line 351 of file DataTable.php.

◆ _generateBehavior()

_generateBehavior (   $op,
  $params,
JsUtils  $js 
)
protected

Definition at line 107 of file DataTable.php.

◆ _generateContent()

_generateContent (   $table)
protected

Reimplemented in JsonDataTable.

Definition at line 218 of file DataTable.php.

◆ _generateGroupByRow()

_generateGroupByRow (   $index,
  $gbField,
  $table,
  $fields,
$activeValues,
$uuids 
)
protected

Definition at line 251 of file DataTable.php.

◆ _generateHeader()

_generateHeader ( HtmlTable  $table,
  $captions 
)
protected

Definition at line 207 of file DataTable.php.

◆ _generatePagination()

_generatePagination (   $table)
protected

Definition at line 321 of file DataTable.php.

◆ _generateRow()

_generateRow (   $instance,
  $fields,
$table,
  $checkedClass = null,
  $uuids = null 
)
protected

Definition at line 287 of file DataTable.php.

◆ _getFieldCaption()

_getFieldCaption (   $index)
protected

Reimplemented from Widget.

Definition at line 374 of file DataTable.php.

◆ _getFieldName()

_getFieldName (   $index)
protected

Reimplemented from Widget.

Definition at line 364 of file DataTable.php.

◆ _hideColumns()

_hideColumns ( )
protected

Definition at line 200 of file DataTable.php.

◆ _setToolbarPosition()

_setToolbarPosition (   $table,
  $captions = NULL 
)
protected

Reimplemented from Widget.

Definition at line 394 of file DataTable.php.

◆ addGroupBy()

addGroupBy (   $index)

Definition at line 734 of file DataTable.php.

◆ addSearchInToolbar()

addSearchInToolbar (   $position = Direction::RIGHT)

Adds a search input in toolbar.

Parameters
string$position
Returns
\Ajax\common\html\HtmlDoubleElement

Definition at line 523 of file DataTable.php.

◆ addToolbarRow()

addToolbarRow (   $part,
  $table,
  $captions 
)
private

Definition at line 419 of file DataTable.php.

◆ afterCompile()

afterCompile (   $index,
  $callback 
)

Associates a $callback function after the compilation of the field at $index position The $callback function can take the following arguments : $field=>the compiled field, $instance : the active instance of the object, $index: the field position.

Parameters
int$indexpostion of the compiled field
callable$callbackfunction called after the field compilation
Returns
DataTable

Reimplemented from Widget.

Definition at line 414 of file DataTable.php.

◆ applyToolbarPosition()

applyToolbarPosition ( string  $position,
  $table,
  $captions = NULL 
)
protected

Definition at line 378 of file DataTable.php.

◆ asForm()

asForm ( )

Returns a form corresponding to the Datatable.

Returns
\Ajax\semantic\html\collections\form\HtmlForm

Definition at line 553 of file DataTable.php.

◆ autoPaginate()

autoPaginate (   $page = 1,
  $items_per_page = 10,
  $pages_visibles = 4 
)

Auto Paginates the DataTable element with a Semantic HtmlPaginationMenu component.

Parameters
number$pagethe active page number
number$items_per_pageThe number of items per page
number$pages_visiblesThe number of visible pages in the Pagination component
Returns
DataTable

Definition at line 500 of file DataTable.php.

◆ compile()

compile ( JsUtils  $js = NULL,
$view = NULL 
)

Reimplemented from BaseHtml.

Definition at line 138 of file DataTable.php.

◆ compileExtraElements()

compileExtraElements (   $table,
  $captions 
)
protected

Definition at line 175 of file DataTable.php.

◆ getActiveRowClass()

getActiveRowClass ( )

Definition at line 647 of file DataTable.php.

◆ getDeleteBehavior()

getDeleteBehavior ( )
Returns
mixed

Definition at line 690 of file DataTable.php.

◆ getDisplayBehavior()

getDisplayBehavior ( )
Returns
mixed

Definition at line 706 of file DataTable.php.

◆ getEditBehavior()

getEditBehavior ( )
Returns
mixed

Definition at line 698 of file DataTable.php.

◆ getElementContent()

getElementContent (   $elm)
private

Definition at line 269 of file DataTable.php.

◆ getFieldValue()

getFieldValue (   $index)

Definition at line 276 of file DataTable.php.

◆ getGroupByFields()

getGroupByFields ( )
Returns
mixed

Definition at line 722 of file DataTable.php.

◆ getHtmlComponent()

getHtmlComponent ( )

{}

See also
Widget::getHtmlComponent()
Returns
HtmlTable

Reimplemented from Widget.

Definition at line 438 of file DataTable.php.

◆ getNamePrefix()

getNamePrefix ( )
Returns
mixed

Definition at line 776 of file DataTable.php.

◆ getPaginationToolbar()

getPaginationToolbar ( )
Returns
\Ajax\semantic\html\collections\menus\HtmlPaginationMenu

Definition at line 753 of file DataTable.php.

◆ getRefreshSelector()

getRefreshSelector ( )

Definition at line 582 of file DataTable.php.

◆ getRowClass()

getRowClass ( )

Definition at line 611 of file DataTable.php.

◆ getSearchField()

getSearchField ( )

Definition at line 528 of file DataTable.php.

◆ getTable()

getTable ( )
protected

{}

See also
TableTrait::getTable()

Definition at line 121 of file DataTable.php.

◆ getTargetSelector()

getTargetSelector (   $op)
protected

Definition at line 557 of file DataTable.php.

◆ getUrls()

getUrls ( )

Definition at line 442 of file DataTable.php.

◆ hasActiveRowSelector()

hasActiveRowSelector ( )

Definition at line 651 of file DataTable.php.

◆ hideColumn()

hideColumn (   $colIndex)

Definition at line 655 of file DataTable.php.

◆ onActiveRowChange()

onActiveRowChange (   $jsCode)

Definition at line 681 of file DataTable.php.

◆ onNewRow()

onNewRow (   $callback)

The callback function called after the insertion of each row when fromDatabaseObjects is called callback function takes the parameters $row : the row inserted and $object: the instance of model used.

Parameters
callable$callback
Returns
DataTable

Definition at line 543 of file DataTable.php.

◆ paginate()

paginate (   $page,
  $total_rowcount,
  $items_per_page = 10,
  $pages_visibles = null 
)

Paginates the DataTable element with a Semantic HtmlPaginationMenu component.

Parameters
number$pagethe active page number
number$total_rowcountthe total number of items
number$items_per_pageThe number of items per page
number$pages_visiblesThe number of visible pages in the Pagination component
Returns
DataTable

Reimplemented in JsonDataTable.

Definition at line 484 of file DataTable.php.

◆ refresh()

refresh (   $compileParts = [ 'tbody' ])
Parameters
array$compileParts
Returns
DataTable

Definition at line 510 of file DataTable.php.

◆ refreshTD()

refreshTD (   $fieldName,
  $jquery,
  $view 
)

Definition at line 130 of file DataTable.php.

◆ refreshTR()

refreshTR ( )

Definition at line 125 of file DataTable.php.

◆ run()

run ( JsUtils  $js)

Parameters
JsUtils$js
Returns
SimpleExtComponent
See also
\Ajax\common\html\BaseHtmlrun()
See also
\Ajax\common\html\BaseHtmlrun()
See also
\Ajax\common\html\BaseHtmlrun()

See also
\Ajax\common\html\BaseHtml::run()

Reimplemented from Widget.

Definition at line 75 of file DataTable.php.

◆ setActiveRowSelector()

setActiveRowSelector (   $class = "active",
  $event = "click",
  $multiple = false 
)

Definition at line 642 of file DataTable.php.

◆ setColAlignment()

setColAlignment (   $colIndex,
  $alignment 
)

Definition at line 672 of file DataTable.php.

◆ setColWidth()

setColWidth (   $colIndex,
  $width 
)

Definition at line 662 of file DataTable.php.

◆ setColWidths()

setColWidths (   $_colWidths)

Definition at line 667 of file DataTable.php.

◆ setDisplayBehavior()

setDisplayBehavior (   $_displayBehavior)
Parameters
mixed$_displayBehavior

Definition at line 714 of file DataTable.php.

◆ setEmptyMessage()

setEmptyMessage (   $_emptyMessage)

Sets the message displayed when there is no record.

Parameters
mixed$_emptyMessage
Returns
DataTable

Definition at line 632 of file DataTable.php.

◆ setFocusable()

setFocusable ( bool  $focusable)

Definition at line 764 of file DataTable.php.

◆ setFormCaption()

setFormCaption (   $caption)

Definition at line 768 of file DataTable.php.

◆ setGroupByFields()

setGroupByFields (   $_groupByFields)
Parameters
mixed$_groupByFields

Definition at line 730 of file DataTable.php.

◆ setInverted()

setInverted (   $recursive = true)

can be formatted to appear on dark backgrounds

Reimplemented from BaseTrait.

Definition at line 757 of file DataTable.php.

◆ setNamePrefix()

setNamePrefix (   $namePrefix)
Parameters
mixed$namePrefix

Definition at line 784 of file DataTable.php.

◆ setRefreshSelector()

setRefreshSelector (   $_refreshSelector)
Parameters
string$_refreshSelector
Returns
DataTable

Definition at line 593 of file DataTable.php.

◆ setRowClass()

setRowClass (   $_rowClass)

Sets the default row class (tr class)

Parameters
string$_rowClass
Returns
DataTable

Definition at line 621 of file DataTable.php.

◆ setSortable()

setSortable (   $colIndex = NULL)

Reimplemented from TableTrait.

Definition at line 637 of file DataTable.php.

◆ setTargetSelector()

setTargetSelector (   $_targetSelector)

Sets the response element selector for Edit and Delete request with ajax.

Parameters
string | array$_targetSelectorstring or associative array ["edit"=>"edit_selector","delete"=>"delete_selector"]
Returns
DataTable

Definition at line 571 of file DataTable.php.

◆ setUrls()

setUrls (   $urls)

Sets the associative array of urls for refreshing, updating or deleting think of defining the update zone with the setTargetSelector method.

Parameters
string | array$urlsassociative array with keys refresh: for refreshing with search field or pagination, edit : for updating a row, delete: for deleting a row
Returns
DataTable

Definition at line 454 of file DataTable.php.

◆ setVisibleHover()

setVisibleHover (   $_visibleHover)
Parameters
boolean$_visibleHover

Definition at line 745 of file DataTable.php.

◆ show()

show (   $modelInstance)

{}

See also
\Ajax\common\Widget::show()

Reimplemented from Widget.

Definition at line 603 of file DataTable.php.

◆ trigger()

trigger (   $event,
  $params = "[]" 
)

Reimplemented from BaseHtmlEventsTrait.

Definition at line 677 of file DataTable.php.

Field Documentation

◆ $_caption

$_caption
protected

Definition at line 63 of file DataTable.php.

◆ $_colWidths

$_colWidths
protected

Definition at line 59 of file DataTable.php.

◆ $_compileParts

$_compileParts
protected

Definition at line 35 of file DataTable.php.

◆ $_deleteBehavior

$_deleteBehavior
protected

Definition at line 37 of file DataTable.php.

◆ $_displayBehavior

$_displayBehavior
protected

Definition at line 41 of file DataTable.php.

◆ $_editBehavior

$_editBehavior
protected

Definition at line 39 of file DataTable.php.

◆ $_emptyMessage

$_emptyMessage
protected

Definition at line 49 of file DataTable.php.

◆ $_hiddenColumns

$_hiddenColumns
protected

Definition at line 57 of file DataTable.php.

◆ $_json

$_json
protected

Definition at line 51 of file DataTable.php.

◆ $_namePrefix

$_namePrefix
protected

Definition at line 65 of file DataTable.php.

◆ $_pagination

$_pagination
protected

Definition at line 33 of file DataTable.php.

◆ $_paginationToolbar

$_paginationToolbar
protected

Definition at line 61 of file DataTable.php.

◆ $_refreshSelector

$_refreshSelector
protected

Definition at line 47 of file DataTable.php.

◆ $_rowClass

$_rowClass = "_element"
protected

Definition at line 53 of file DataTable.php.

◆ $_searchField

$_searchField
protected

Definition at line 29 of file DataTable.php.

◆ $_sortable

$_sortable
protected

Definition at line 55 of file DataTable.php.

◆ $_targetSelector

$_targetSelector
protected

Definition at line 45 of file DataTable.php.

◆ $_urls

$_urls
protected

Definition at line 31 of file DataTable.php.

◆ $_visibleHover

$_visibleHover = false
protected

Definition at line 43 of file DataTable.php.


The documentation for this class was generated from the following file: