pacx webresources js resetTemplate - neronotte/Greg.Xrm.Command GitHub Wiki

Allows to restore the default templates used for JS WebResources to the one shipped by default by PACX.

Aliases

pacx wr js resetTemplate
pacx wr resetTemplate js

Usage

This command can be used whenever you have overridden the default templates used to create JS WebResources via pacx webresources js setTemplate and you want to restore the default templates shipped by PACX. The command will restore the default templates for the specified type.

The default templates are:

Form

class Form {
	formType = {
		Create: 1,
		Update: 2,
		ReadOnly: 3,
		Disabled: 4,
		BulkEdit: 6
	};

	onLoad(executionContext) {
		const formContext = executionContext.getFormContext();
		const formType = formContext.ui.getFormType();
	}
}

%NAMESPACE% = window.%NAMESPACE% || {};
%NAMESPACE%.%TABLE% = %NAMESPACE%.%TABLE% || {};
%NAMESPACE%.%TABLE%.Form = new Form();

Ribbon (command bar) - Table-related

class Ribbon {
}

%NAMESPACE% = window.%NAMESPACE% || {};
%NAMESPACE%.%TABLE% = %NAMESPACE%.%TABLE% || {};
%NAMESPACE%.%TABLE%.Ribbon = new Ribbon();

Ribbon (command bar) - Global

class Ribbon {
}

%NAMESPACE% = window.%NAMESPACE% || {};
%NAMESPACE%.Global = %NAMESPACE%.Global || {};
%NAMESPACE%.Global.Ribbon = new Ribbon();

Other

class Common {
}

%NAMESPACE% = window.%NAMESPACE% || {};
%NAMESPACE%.Common = new Common();

Arguments

Long Name Short Name Required? Description Default value Valid values
type t Y The type of the template to restore. Form Form, Ribbon, Other
forTable ft N To be used in conjunction with --type Ribbon, indicates if the template is for a table command bar. If not specified, is assumed as a global command bar. False true, false