In the detail view , I would like to add a button that will pop up with a function similar to the “Change Log” window. I have successfully added the button, but when I click the button, it will prompt: ‘Unexpected error.’ No handler defined for the select bulk action ’
in the detailviewdefs.php file, has been add code:
'recordActions' => [
'actions' => [
'select-product-button-action' => [
'key' => 'select-product-button-action',
'labelKey' => 'LBL_SELECT_PORD',
'asyncProcess' => true,
'modes' => ['detail'],
'acl' => ['view'],
'aclModule' => 'ycfy_Order',
'service' => 'SelectProductButtonAction',
'params' => [
'expanded' => true,
],
],
],
],
and add file:
extensions/defaultExt/backend/modules/ycfy_Order/Service/SelectProductButtonAction.php
run function code :
public function run(Process $process)
{
$options = $process->getOptions();
$auditModuleName = $this->moduleNameMapper->toLegacy($options['module']);
$recordId = $options['id'];
$baseUrl = './legacy/index.php';
$queryParams = [
'module' => 'ycfy_Product',
'action' => 'popup',
'module_name' => 'ycfy_Product',
'record' => $recordId,
'query' => true,
'mode' => 'multiple',
'create' => false,
];
$legacyUrl = $baseUrl . "?" . http_build_query($queryParams);
$responseData = [
'handler' => 'custom',
'params' => [
'url' => $legacyUrl,
'titleKey' => 'LBL_SELECT_PORD',
'queryParams' => [
]
]
];
$process->setStatus('success');
$process->setMessages([]);
$process->setData($responseData);
}
and on path:
core/app/core/src/lib/services/process/processes/async-action/actions
add dir: custom
on the dir “custom” add file:
custom.async-action.ts
custom.async-action.spec.mock.ts
the two file refer to: core/app/core/src/lib/services/process/processes/async-action/actions/changelog
and edit file: async-action.ts
edit code,add
customAction :
constructor(
private processService: ProcessService,
private appStateStore: AppStateStore,
protected message: MessageService,
protected redirectAction: RedirectAsyncAction,
protected exportAction: ExportAsyncAction,
protected noopAction: NoopAsyncAction,
protected changelogAction: ChangelogAsyncAction,
protected customAction: CustomAsyncAction
) {
this.registerHandler(redirectAction);
this.registerHandler(exportAction);
this.registerHandler(noopAction);
this.registerHandler(changelogAction);
this.registerHandler(customAction);
}