| Methods |
protected
|
init(): void
Called when view becomes part of render tree. You can override it but avoid
placing any "heavy processing" here.
Called when view becomes part of render tree. You can override it but avoid
placing any "heavy processing" here.
Overrides
|
#
|
public
|
applySort(): void
Apply ordering to the current model as per the sort parameters.
Apply ordering to the current model as per the sort parameters.
Overrides
|
#
|
public
|
setModel(Model $model, array $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
|
#
|
protected
|
initActionExecutor(UserAction $action): AbstractView&ExecutorInterface
Setup executor for an action.
First determine what fields action needs,
then setup executor based on action fields,…
Setup executor for an action.
First determine what fields action needs,
then setup executor based on action fields, args and/or preview.
Add hook for onStep 'fields'" Hook can call a callback function
for UserAction onStep field. Callback will receive executor form where you
can setup Input field via javascript prior to display form or change form submit event
handler.
|
#
|
protected
|
jsExecute(string|null $return, UserAction $action): JsBlock
Return proper JS statement for afterExecute hook on action executor
depending on return type, model loaded and action…
Return proper JS statement for afterExecute hook on action executor
depending on return type, model loaded and action scope.
|
#
|
protected
|
getJsGridAction(UserAction $action): ?JsExpressionable
Return proper JS actions depending on action modifier type.
Return proper JS actions depending on action modifier type.
|
#
|
protected
|
jsCreateNotifier(string $msg = null): JsExpressionable
Override this method for setting notifier based on action or model value.
Override this method for setting notifier based on action or model value.
|
#
|
protected
|
setItemsAction(): void
Setup JS for firing menu action.
Setup JS for firing menu action.
|
#
|
protected
|
getExecutor(UserAction $action): AbstractView&ExecutorInterface
Return proper action executor base on model action.
Return proper action executor base on model action.
|
#
|
private
|
_getReloadArgs(): mixed
Return reload argument based on Crud condition.
Return reload argument based on Crud condition.
|
#
|
private
|
_getModelActions(string $appliesTo): array
Return proper action need to setup menu or action column.
Return proper action need to setup menu or action column.
|
#
|
public
|
onFormAdd(Closure(Form, ModalExecutor): void $fx): void
Set callback for add action in Crud.
Callback function will receive the Add Form and Executor as param.
Set callback for add action in Crud.
Callback function will receive the Add Form and Executor as param.
|
#
|
public
|
onFormEdit(Closure(Form, ModalExecutor): void $fx): void
Set callback for edit action in Crud.
Callback function will receive the Edit Form and Executor as param.
Set callback for edit action in Crud.
Callback function will receive the Edit Form and Executor as param.
|
#
|
public
|
onFormAddEdit(Closure(Form, ModalExecutor): void $fx): void
Set callback for both edit and add action form.
Callback function will receive Forms and Executor as param.
Set callback for both edit and add action form.
Callback function will receive Forms and Executor as param.
|
#
|
public
|
setOnActions(string $actionName, Closure(Form, ModalExecutor): void $fx): void
Set onActions.
|
#
|
| Properties |
public
|
array
|
$displayFields
of fields to display in Grid
of fields to display in Grid
|
#
|
public
|
array|null
|
$editFields
of fields to edit in Form for Model edit action
of fields to edit in Form for Model edit action
|
#
|
public
|
array|null
|
$addFields
of fields to edit in Form for Model add action
of fields to edit in Form for Model add action
|
#
|
public
|
array
|
$notifyDefault = [JsToast::class]
Default notifier to perform when adding or editing is successful *
Default notifier to perform when adding or editing is successful *
|
#
|
public
|
bool|null
|
$useMenuActions
should we use table column drop-down menu to display user actions?
should we use table column drop-down menu to display user actions?
|
#
|
private
|
array<string, array{item: MenuItem, executor: (AbstractView&ExecutorInterface)}>
|
$menuItems = []
Collection of APPLIES_TO_NO_RECORDS Scope Model action menu item
Collection of APPLIES_TO_NO_RECORDS Scope Model action menu item
|
#
|
public
|
array
|
$singleScopeActions = []
Model single scope action to include in table action column. Will include all single scope actions if empty.
Model single scope action to include in table action column. Will include all single scope actions if empty.
|
#
|
public
|
array
|
$noRecordScopeActions = []
Model no_record scope action to include in menu. Will include all no record scope actions if empty.
Model no_record scope action to include in menu. Will include all no record scope actions if empty.
|
#
|
public
|
string
|
$saveMsg = 'Record has been saved!'
Message to display when record is add or edit successfully.
Message to display when record is add or edit successfully.
|
#
|
public
|
string
|
$deleteMsg = 'Record has been deleted!'
Message to display when record is delete successfully.
Message to display when record is delete successfully.
|
#
|
public
|
string
|
$defaultMsg = 'Done!'
Generic display message for no record scope action where model is not loaded.
Generic display message for no record scope action where model is not loaded.
|
#
|
public
|
array<int, array<string, Closure(Form, ModalExecutor): void>>
|
$onActions = []
Callback containers for model action.
Callback containers for model action.
|
#
|
private
|
mixed
|
$deletedId
recently deleted record ID.
recently deleted record ID.
|
#
|