Hello,
Please we need the method of how we can create a custom handler on button click to create a loader after some actions are completed for example:
we have a button to trigger a business process, save the record, and show a message but the message takes a lot of time to show so we need to create a loader until the message shows, please let us know how we can do this.
Thank you,
-Georges
Like
2 comments
16:59 Jan 24, 2024
I'm not sure that I understood your needs.
I haven't tested it, but I believe that something like this would work.
define("UsrYour_FormPage", /**SCHEMA_DEPS*/[]/**SCHEMA_DEPS*/,
function/**SCHEMA_ARGS*/()/**SCHEMA_ARGS*/ {
return {
viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
{
"operation": "insert",
"name": "YourButton",
"values": {
"type": "crt.Button",
"caption": "Your button caption",
"color": "accent",
"size": "large",
"iconPosition": "only-text",
"visible": true,
"clicked": {
"request": "usr.YourCustomRequest"
},
"clickMode": "default"
},
"parentName": "ActionButtonsContainer",
"propertyName": "items",
"index": 0
}
]/**SCHEMA_VIEW_CONFIG_DIFF*/,
viewModelConfig: /**SCHEMA_VIEW_MODEL_CONFIG*/{}/**SCHEMA_VIEW_MODEL_CONFIG*/,
modelConfig: /**SCHEMA_MODEL_CONFIG*/{}/**SCHEMA_MODEL_CONFIG*/,
handlers: /**SCHEMA_HANDLERS*/[
{
request: "usr.YourCustomRequest",
handler: async (request, next) => {
request.$context.maskService.showBodyMask();
await //your logic
request.$context.maskService.hideBodyMask();
return next?.handle(request);
}
}
]/**SCHEMA_HANDLERS*/,
converters: /**SCHEMA_CONVERTERS*/{}/**SCHEMA_CONVERTERS*/,
validators: /**SCHEMA_VALIDATORS*/{}/**SCHEMA_VALIDATORS*/
};
});
20:05 Feb 15, 2025
`showBodyMask` is working fine.
But, can we display custom Loader message?
Show all comments