Hi there!
I’m quite new to mgm A12.
I’ve created an Overview Model with a Custom Row Action. In the browser console I see that the event gets triggered when clicking on a row. In the Client Developer documentation (v 12.3) I found just two lines saying that in order to use customRowAction I need to register a middleware similar to “onEvent”. I’ve created this middleware and registered it in the module but the middleware isn’t called when clicking on a row. Could you please provide a complete code example of how to use a Custom Row Action (or a link to such an example which I didn’t find so far)?
Many thanks in advance
Hi UlfZimmermann,
I didn’t try with the Custom Row Action yet. But if you want to change the behavior when user click on a row in overview, you can try with writing a custom overview, then custom the onDocumentClick for your overview.
This is what I did:
export function CustomEventOverviewEngineView(props: ViewViews.OverviewEngineViewProps): React.ReactElement {
const dispatch: Dispatch = useDispatch();
const onEventButtonClick = (eventName: string) => {
dispatch(
overviewEngineEvent({
activityId: props.activity.id,
engineEvent: eventName
})
);
};
const onDocumentClick = (documentId: string, model: string) => {
dipatch(rowAction({
activityId: props.activity.id,
instanceId: '',
modelId: ''
})
)
};
return (
<ViewViews.OverviewEngineView
{...props}
eventHandlers={{onEventButtonClick}}
onDocumentClick={onDocumentClick}
/>
);
}
Thank you, pplthai! I will give it a try if there is no solution with Custom Row Action itself.
Hi @ulf-azure-tensor,
the information you found inside the a12 client documentation regarding the custom row action is only about repeats inside a form engine (defined by form model).
The only solution for the overview engine extension of A12 Client you are probably using is the way described by pplthais comment.
I guess on your try outs you faced some console log like the following.
see in A12 Client (12.3.0) package: /@com.mgmtp.a12.client/client-core/src/extensions/crud/internal/components/overview-engine.tsx#217
onDocumentClick(id, model, customEvent) {
if (customEvent) {
logger.warn(
`Event '${customEvent}' has been fired onDocumentClick, ` +
`but cannot be handled by the CRUD extension.`
);
} else {
dispatch(
CRUDActions.selectRow({
//...