-
Notifications
You must be signed in to change notification settings - Fork 34
classes_lib_controls_listing_wdflisting.class
High level listing control. It represents a database table with paging, sorting and more features.
Implements: <>
Extends: Control » Renderable
SHORTCUT Table::AddRowAction
Adds a callback for column rendering.
Definition: public function addColCallback($colnames, $callback)
Returns: static
Parameters:
-
array|string $colnamesColumn name(s) -
callable $callbackCallback, signature: function($value, $row){ return 'rendered value'; }
Adds a CSS class to columns.
Definition: public function addColClass($name, $class=false)
Returns: static
Parameters:
-
array|string $nameColumn name or array of column names and class-values. -
mixed $classOptional Class-Value, if $name is a string.
Adds a column to be rendered.
Definition: public function addColumn($name, $label, $format=false, $alignment)
Returns: static
Parameters:
-
mixed $nameColumn name. If this matches a databse column, those values will be rendered. -
mixed $labelColumn label. -
mixed $formatColumn format or callback with signature function($v,$row){ return 'rendered'; }. -
mixed $alignmentColumn alignment.
Adds a column based on a subquery.
Definition: public function addComplexColumn($name, $label, $sql, $arguments, $format=false, $alignment)
Returns: static
Parameters:
-
mixed $nameColumn name. -
mixed $labelColulmn label -
mixed $sqlSQL statement -
mixed $argumentsSQL arguments -
mixed $formatColumn format or callback. -
mixed $alignmentColumn alignment.
Adds a column based on a subquery.
Definition: public function addField($sql, $arguments)
Returns: static
Parameters:
-
mixed $sqlSQL statement (something like "(select a from tab) as colname" ) -
mixed $argumentsSQL arguments.
Adds a join clause to the underlying query.
Definition: public function addJoin($j)
Returns: static
Parameters:
-
mixed $jValid SQL JOIN clause
Adds a multi-action to the listing.
Definition: public function addMultiAction($label, $url)
Returns: static
Parameters:
-
mixed $labelAction label -
mixed $urlURL to be called when the action is triggered
Adds a pager to the listing
Definition: public function addPager($items_per_page, $allow_reset_pager=true)
Returns: static
Parameters:
-
mixed $items_per_pageItems per page -
mixed $allow_reset_pagerInternal: Allows the internal logic to reset the pager to page 1
Adds a callback for row preprocessing.
Definition: public function addRowCallback($callback)
Returns: static
Parameters:
-
mixed $callbackCallback, signature: function($row,$tr){ return $row; }
Adds a callback for data preprocessing.
Definition: public function addRowDataCallback($callback)
Returns: static
Parameters:
-
mixed $callbackCallback, signature: function($row){ return $row; }
Adds a summary column to the table.
Definition: public function addSummaryCol($name, $label=false, $format=false)
Returns: static
Parameters:
-
mixed $nameColumn name. -
mixed $labelColumn label. -
mixed $formatColumn format or callback function.
Clears all columns.
Definition: public function clearColumns()
Returns: static
Returns the number of found rows. Note that this is not the total number of rows, but the number of rows on the current result page.
Definition: public function countRows()
Returns: mixed
INTERNAL Used in browser-navigation to jump to the correct listing state.
Deletes a column.
Definition: public function delColumn($name)
Returns: static
Parameters:
-
mixed $nameColumn name
INTERNAL Ajax callback for data export.
INTERNAL
INTERNAL Filter array values to visible values.
INTERNAL Get the underlying ResultSet
Returns the queried tables name.
Definition: public function GetTableName()
Returns: mixed
INTERNAL Will be polled via AJAX to change the page if you defined a pager using DatabaseTable
INTERNAL Get index of (visible) column by name.
INTERNAL
Checks if a column is visible
Definition: protected function isVisible($column_name)
Returns: bool True is visible, false otherwise
Parameters:
-
mixed $column_nameColumn name
Constructs a WdfListing control.
Definition: public static function Make($args)
Returns: static
Parameters:
-
array $argsOne, two or three arguments. If one, must be Model datatype. If two must be Model datatype and database table, if Three must be Model datatype, UI controller and database table.
SHORTCUT $this->setOptional($columns_to_remove)->setItemsPerPage($items_per_page)
Moves a column to another position.
Definition: public function moveColumn($colToMoveName, $insertBeforeName)
Returns: static
Parameters:
-
mixed $colToMoveNameColumn name to move -
mixed $insertBeforeNameColumn name to insert before
INTERNAL Header rendering
INTERNAL Row rendering
Prepends a column to the list of columns.
Definition: public function prependColumn($name, $label, $format=false, $alignment)
Returns: static
Parameters:
-
mixed $nameColumn name -
mixed $labelColumn label -
mixed $formatColumn format or callback with signature function($v,$row){ return 'rendered'; }. -
mixed $alignmentColumn alignment.
INTERNAL
INTERNAL Will be polled via AJAX to reload listing. Optionally for a specific state.
INTERNAL Resets the wrapped DatabaseTable
INTERNAL
Resets the pager to page 1.
Definition: public function ResetPager()
Returns: static
INTERNAL Used in automatic setting store
INTERNAL Used in browser-navigation to jump to the correct listing state.
Set a columns alignment.
Definition: public function setAlignment($name, $alignment)
Returns: static
Parameters:
-
mixed $nameColumn name -
mixed $alignmentColumn alignment.
Sets the controller to be used as details target.
Definition: public function setController($controller)
Returns: static
Parameters:
-
mixed $controllerController name
Sets the used CultureInfo.
Definition: public function setCulture($ci)
Returns: static
Parameters:
-
\ScavixWDF\Localization\CultureInfo|string $ciThe ci to use.
Sets the Model datatype.
Definition: public function setDataType($type)
Returns: static
Parameters:
-
mixed $typeModel datatype (like MyCustomModel::class)
Sets content to be displayed if no data is found.
Definition: public function setEmptyContent($content)
Returns: static
Parameters:
-
mixed $contentContent to be displayed.
Toggles the export feature.
Definition: public function setExportable($on=true)
Returns: static
Parameters:
-
mixed $onIf true, the export feature is enabled.
Sets a data filter. Data filters are combined using AND and will be used as WHERE clause. $sql may be a string or a WdfListingFilter object.
Definition: public function setFilter($sql, $params, $replace=false)
Returns: static
Parameters:
-
mixed $sqlSQL query or WdfListingFilter object. -
mixed $paramsParameters for the SQL query. -
mixed $replaceIf true all previous setFilter calls will be replaced.
INTERNAL Sets values for the current WdfListingFilter
Set a columns format and alignment.
Definition: public function setFormat($name, $format, $alignment)
Returns: static
Parameters:
-
mixed $nameColumn name -
mixed $formatColumn format or callback with signature function($v,$row){ return 'rendered'; }. -
mixed $alignmentColumn alignment.
Set gear mode. "Gear" is the top-right icon that allows advanced listing interaction.
Definition: public function setGearMode($gear_mode, $optional_default=false)
Returns: static
Parameters:
-
mixed $gear_modeOnce of the GEAR_MODE_* constants. -
mixed $optional_defaultDefault 'visible' value for optional columns.
Sets data grouping.
Definition: public function setGroupBy($groupby)
Returns: static
Parameters:
-
mixed $groupbySQL ready GROUP BY clause (may be just a column name)
Sets pagers items per page.
Definition: public function setItemsPerPage($perpage, $allow_reset_pager=true)
Returns: static
Parameters:
-
mixed $perpageItems per page -
mixed $allow_reset_pagerInternal: Allows the internal logic to reset the pager to page 1
Set a columns label.
Definition: public function setLabel($name, $label)
Returns: static
Parameters:
-
mixed $nameColumn name -
mixed $labelColumn label
Toggles SQL logging.
Definition: public function setLogSql($on=true)
Returns: static
Parameters:
-
mixed $onIf true, the SQL logging is enabled.
Allows tuning the multi-action-grouping feature. If there are many multi-actions, they can be grouped into a select control.
Definition: public function setMultiActionGrouping($on=true, int $treshold)
Returns: static
Parameters:
-
mixed $onIf true, grouping will be enabled. -
int $tresholdThe minimum number of actions to allow grouping.
Controls the multi-selectable frature.
Definition: public function setMultiSelectable($valuerowid, $checkboxname, $label, $url)
Returns: static
Parameters:
-
mixed $valuerowidName of the row that holds the dataset id values (id, uid,...) -
mixed $checkboxnameName of the chackbox controls -
mixed $labelIf label and URL are given, shortcuts to WdfListing::addMultiAction -
mixed $urlIf label and URL are given, shortcuts to WdfListing::addMultiAction
Disables the multi-selectable frature.
Definition: public function setMultiSelectableOff()
Returns: static
Sets columns optional, they will be hidden in the GEAR dropdown.
Definition: public function setOptional($column_name)
Returns: static
Parameters:
-
array|string $column_nameColumn name or array of column names.
Sets the order of the listing data. Multiple setOrder calls will result in multiple ORDER BY clauses.
Definition: public function setOrder($orderby)
Returns: static
Parameters:
-
mixed $orderbySQL ready ORDER BY clause (may be just a column name)
Sets a text to be displayed next to the pager.
Definition: public function setPagerText($text)
Returns: static
Parameters:
-
mixed $textText to be displayed.
Sets up an extra key for automatich state storage.
Definition: public function setPersistKeyExtra($extra)
Returns: static
Parameters:
-
mixed $extraSome extra seed
Toggles read-only mode. In read-only mode, the user cannot click on rows to be redirected to 'details' page.
Definition: public function setReadonly($on=true)
Returns: static
Parameters:
-
mixed $onIf true, the read-only mode is enabled.
Toggles the sorting feature.
Definition: public function setSortable($on=true)
Returns: static
Parameters:
-
mixed $onIf true, the sorting feature is enabled.
Sets up the summary feature.
Definition: public function setSummary($args)
Returns: static
Parameters:
-
array $argsArray of summary specifications, that is column_name, label, format
Sets the table to be queried for data.
Definition: public function setTable($table)
Returns: static
Parameters:
-
mixed $tableTable name
INTERNAL Switch data sorting
Returns the storage buffer.
Definition: public static function Storage()
Returns: \ScavixWDF\WdfBuffer
INTERNAL Toggles a columns visibility
INTERNAL Get visible column names.
INTERNAL