| Methods |
protected
|
initChunks(): void
From the current template will extract {row} into $this->tRowMaster and {empty} into $this->tEmpty.
From the current template will extract {row} into $this->tRowMaster and {empty} into $this->tEmpty.
Overrides
|
#
|
public
|
addColumn(
string|null $name,
array|Column $columnDecorator = [],
($name is null ? array{} : array|Field) $field = [],
): Column
Defines a new column for this field. You need two objects for field to
work.
Defines a new column for this field. You need two objects for field to
work.
First is being Model field. If your Table is already associated with
the model, it will automatically pick one by looking up element
corresponding to the $name or add it as per your definition inside $field.
The other object is a Column Decorator. This object know how to produce HTML for
cells and will handle other things, like alignment. If you do not specify
column, then it will be selected dynamically based on field type.
If you don't want table column to be associated with model field, then
pass $name parameter as null.
Parameters
| $name |
Data model field name
|
|
#
|
private
|
_addUnchecked(Column $column): Column
|
#
|
public
|
setFilterColumn(array $cols = null): void
Set Popup action for columns filtering.
Set Popup action for columns filtering.
Parameters
| $cols |
an array with columns name that need filtering
|
|
#
|
public
|
addDecorator(string $name, array|Column $seed): Column
Add column Decorator.
|
#
|
public
|
getColumnDecorators(string $name): array
Return array of column decorators for particular column.
Return array of column decorators for particular column.
|
#
|
protected
|
getColumn(string $name): Column
Return column instance or first instance if using decorator.
Return column instance or first instance if using decorator.
|
#
|
public
|
decoratorFactory(Field $field, array|Column $seed = []): Column
Will come up with a column object based on the field object supplied.
By default will use default column.
Will come up with a column object based on the field object supplied.
By default will use default column.
|
#
|
public
|
resizableColumn(
Closure(Jquery, mixed): (JsExpressionable|View|string|void) $fx = null,
array<int, int> $widths = null,
array $resizerOptions = [],
): $this
Make columns resizable by dragging column header.
Make columns resizable by dragging column header.
The callback function will receive two parameter, a Jquery chain object and a array containing all table columns
name and size.
Parameters
|
#
|
public
|
addJsPaginator($ipp, $options = [], $container = null, $scrollRegion = 'Body')
Add Dynamic paginator when scrolling content via Javascript.
Will output x item in lister set per IPP until user scroll…
Add Dynamic paginator when scrolling content via Javascript.
Will output x item in lister set per IPP until user scroll content to the end of page.
When this happen, content will be reload x number of items.
Parameters
| $ipp |
Number of item per page
|
| $options |
an array with JS Scroll plugin options
|
| $container |
the container holding the lister for scrolling purpose
|
| $scrollRegion |
A specific template region to render. Render output is append to container HTML element.
|
Overrides
|
#
|
public
|
addTotals(array<string, string|array{(string|(Closure(mixed, string, $this): (int|float)))}> $plan = []): void
Override works like this:.
[
'name' => 'Totals for {$num} rows:',
'price' => '--',
'total' => ['sum']
].
Override works like this:.
[
'name' => 'Totals for {$num} rows:',
'price' => '--',
'total' => ['sum']
].
|
#
|
public
|
setModel(Model $model, array<int, string>|null $fields = null): void
Associate this view with a model. Do not place any logic in this class, instead take it
to renderView().
Associate this view with a model. Do not place any logic in this class, instead take it
to renderView().
Do not try to create your own "Model" implementation, instead you must be looking for
your own "Persistence" implementation.
Parameters
| $fields |
if null, then all "editable" fields will be added
|
Overrides
Overriden by
|
#
|
protected
|
renderView(): void
View-specific rendering stuff. Feel free to replace this method with
your own. View::renderView contains some logic…
View-specific rendering stuff. Feel free to replace this method with
your own. View::renderView contains some logic that integrates with
Fomantic-UI.
Overrides
|
#
|
public
|
renderRow(): void
Render individual row. Override this method if you want to do more
decoration.
Render individual row. Override this method if you want to do more
decoration.
Overrides
|
#
|
public
|
onRowClick(JsExpressionable|JsCallbackSetClosure $action): void
Same as on('click', 'tr', $action), but will also make sure you can't
click outside of the body. Additionally when you…
Same as on('click', 'tr', $action), but will also make sure you can't
click outside of the body. Additionally when you move cursor over the
rows, pointer will be used and rows will be highlighted as you hover.
Parameters
|
#
|
public
|
jsRow(): Jquery
Use this to quickly access the <tr> and wrap in Jquery.
Use this to quickly access the and wrap in Jquery.
$this->jsRow()->data('id');
#
|
public
|
jsRemoveRow(string $id, string $transition = 'fade left'): Jquery
Remove a row in table using javascript using a model ID.
Remove a row in table using javascript using a model ID.
Parameters
| $id |
the model ID where row need to be removed
|
| $transition |
the transition effect
|
|
#
|
public
|
updateTotals(): void
Executed for each row if "totals" are enabled to add up values.
Executed for each row if "totals" are enabled to add up values.
|
#
|
public
|
getHeaderRowHtml(): string
Responds with the HTML to be inserted in the header row that would
contain captions of all columns.
Responds with the HTML to be inserted in the header row that would
contain captions of all columns.
|
#
|
public
|
getTotalsRowHtml(): string
Responds with HTML to be inserted in the footer row that would
contain totals for all columns.
Responds with HTML to be inserted in the footer row that would
contain totals for all columns.
|
#
|
public
|
getDataRowHtml(): string
Collects cell templates from all the columns and combine them into row template.
Collects cell templates from all the columns and combine them into row template.
|
#
|
|
| Properties |
public
|
|
$ui = 'table'
|
#
|
public
|
|
$defaultTemplate = 'table.html'
|
#
|
public
|
View|null
|
$reload
|
#
|
public
|
array<int|string, Column|array<int, Column>>
|
$columns = []
Contains list of declared columns. Value will always be a column object.
Contains list of declared columns. Value will always be a column object.
|
#
|
public
|
bool
|
$useHtmlTags = true
|
#
|
public
|
array<string, string|array{(string|(Closure(mixed, string, $this): (int|float)))}>|false
|
$totalsPlan = false
|
#
|
public
|
bool
|
$header = true
Setting this to false will hide header row.
Setting this to false will hide header row.
|
#
|
public
|
array
|
$totals = []
Contains list of totals accumulated during the render process.
Contains list of totals accumulated during the render process.
|
#
|
public
|
HtmlTemplate|null
|
$tHead
Contain the template for the "Head" type row.
Contain the template for the "Head" type row.
|
#
|
public
|
HtmlTemplate
|
$tRowMaster
|
#
|
public
|
HtmlTemplate
|
$tRow
Contain the template for the "Body" type row.
Contain the template for the "Body" type row.
|
#
|
public
|
HtmlTemplate
|
$tTotals
Contain the template for the "Foot" type row.
Contain the template for the "Foot" type row.
|
#
|
public
|
bool|null
|
$sortable
|
#
|
public
|
string
|
$sortBy
|
#
|
public
|
'asc'|'desc'|null
|
$sortDirection
|
#
|
public
|
bool
|
$hasCollapsingCssActionColumn = true
|
#
|
protected
|
array<string, array>
|
$typeToDecorator = [
'atk4_money' => [Money::class],
'text' => [Text::class],
'boolean' => [Status::class, ['positive' => [true], 'negative' => [false]]],
]
|
#
|