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 $colnames
Column name(s) -
callable $callback
Callback, 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 $name
Column name or array of column names and class-values. -
mixed $class
Optional 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 $name
Column name. If this matches a databse column, those values will be rendered. -
mixed $label
Column label. -
mixed $format
Column format or callback with signature function($v,$row){ return 'rendered'; }. -
mixed $alignment
Column alignment.
Adds a column based on a subquery.
Definition: public function addComplexColumn($name, $label, $sql, $arguments, $format=false, $alignment)
Returns: static
Parameters:
-
mixed $name
Column name. -
mixed $label
Colulmn label -
mixed $sql
SQL statement -
mixed $arguments
SQL arguments -
mixed $format
Column format or callback. -
mixed $alignment
Column alignment.
Adds a column based on a subquery.
Definition: public function addField($sql, $arguments)
Returns: static
Parameters:
-
mixed $sql
SQL statement (something like "(select a from tab) as colname" ) -
mixed $arguments
SQL arguments.
Adds a join clause to the underlying query.
Definition: public function addJoin($j)
Returns: static
Parameters:
-
mixed $j
Valid SQL JOIN clause
Adds a multi-action to the listing.
Definition: public function addMultiAction($label, $url)
Returns: static
Parameters:
-
mixed $label
Action label -
mixed $url
URL 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_page
Items per page -
mixed $allow_reset_pager
Internal: 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 $callback
Callback, signature: function($row,$tr){ return $row; }
Adds a callback for data preprocessing.
Definition: public function addRowDataCallback($callback)
Returns: static
Parameters:
-
mixed $callback
Callback, 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 $name
Column name. -
mixed $label
Column label. -
mixed $format
Column 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 $name
Column 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_name
Column name
Constructs a WdfListing control.
Definition: public static function Make($args)
Returns: static
Parameters:
-
array $args
One, 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 $colToMoveName
Column name to move -
mixed $insertBeforeName
Column 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 $name
Column name -
mixed $label
Column label -
mixed $format
Column format or callback with signature function($v,$row){ return 'rendered'; }. -
mixed $alignment
Column 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 $name
Column name -
mixed $alignment
Column alignment.
Sets the controller to be used as details target.
Definition: public function setController($controller)
Returns: static
Parameters:
-
mixed $controller
Controller name
Sets the used CultureInfo.
Definition: public function setCulture($ci)
Returns: static
Parameters:
-
\ScavixWDF\Localization\CultureInfo|string $ci
The ci to use.
Sets the Model datatype.
Definition: public function setDataType($type)
Returns: static
Parameters:
-
mixed $type
Model datatype (like MyCustomModel::class)
Sets content to be displayed if no data is found.
Definition: public function setEmptyContent($content)
Returns: static
Parameters:
-
mixed $content
Content to be displayed.
Toggles the export feature.
Definition: public function setExportable($on=true)
Returns: static
Parameters:
-
mixed $on
If 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 $sql
SQL query or WdfListingFilter object. -
mixed $params
Parameters for the SQL query. -
mixed $replace
If 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 $name
Column name -
mixed $format
Column format or callback with signature function($v,$row){ return 'rendered'; }. -
mixed $alignment
Column 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_mode
Once of the GEAR_MODE_* constants. -
mixed $optional_default
Default 'visible' value for optional columns.
Sets data grouping.
Definition: public function setGroupBy($groupby)
Returns: static
Parameters:
-
mixed $groupby
SQL 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 $perpage
Items per page -
mixed $allow_reset_pager
Internal: 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 $name
Column name -
mixed $label
Column label
Toggles SQL logging.
Definition: public function setLogSql($on=true)
Returns: static
Parameters:
-
mixed $on
If 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 $on
If true, grouping will be enabled. -
int $treshold
The minimum number of actions to allow grouping.
Controls the multi-selectable frature.
Definition: public function setMultiSelectable($valuerowid, $checkboxname, $label, $url)
Returns: static
Parameters:
-
mixed $valuerowid
Name of the row that holds the dataset id values (id, uid,...) -
mixed $checkboxname
Name of the chackbox controls -
mixed $label
If label and URL are given, shortcuts to WdfListing::addMultiAction -
mixed $url
If 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_name
Column 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 $orderby
SQL 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 $text
Text to be displayed.
Sets up an extra key for automatich state storage.
Definition: public function setPersistKeyExtra($extra)
Returns: static
Parameters:
-
mixed $extra
Some 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 $on
If true, the read-only mode is enabled.
Toggles the sorting feature.
Definition: public function setSortable($on=true)
Returns: static
Parameters:
-
mixed $on
If true, the sorting feature is enabled.
Sets up the summary feature.
Definition: public function setSummary($args)
Returns: static
Parameters:
-
array $args
Array 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 $table
Table 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