Question

How To Create a Loader on Freedom

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 0

Like

1 comments

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*/
	};
});

 

Show all comments