fcf.NClient.Wrapper class

[Client only] Template wrapper class on client

Class description

In addition to declared methods, Wrapper objects support methods for handling changes to an individual template argument. Method signature:

onArg[ARGUMENT_NAME](mixed a_value, fcf.NClient.Wrapper a_editor, bool a_ignoreRedrawing, bool a_innerCall, string a_suffix)

ARGUMENT_NAME - The argument name starts with a capital letter.

Arguments:

mixed a_value - The new value to be set.

fcf.NClient.Wrapper a_editor - The object on which the setArg method was called. When applying links, a_editor and this may not be equal

bool a_ignoreRedrawing - Redrawing prohibiting flag

bool a_innerCall - The internal call flag from the template itself is used to build internal processing.

string a_suffix - The path of the modified value in the argument.

Example:

... onArgValue(a_value, a_editor, a_ignoreRedrawing, a_innerCall, a_suffix){ if (this.isChild(a_editor) && this.getArg("defaultFlag")){ this.setArg("defaultFlag", false); } } ...

Methods
fcf.Actions attach() - The method is called every time the template is linked to the wrapper. This method is used in inherited classes.
array check() - Validates the template data and returns an array of objects with error information
destroy() - Deletes the template and the data associated with it
Event emit(string|Event a_event, object a_data) - Sends a Dom event to the wrapper
DomElement getActionDomElement() - Returns the Dom element of the template actions. The template's Dom events pass through this element.
string getAlias() - Returns alias template
mixed getArg(string a_path) - Returns the value of the template argument
object getArgs() - Returns an object with the values of the template arguments
fcf.NClient.Wrapper getChild(string a_alias) - Returns the child wrapper by alias name
[fcf.NClient.Wrapper] getChilds() - Returns an array of child template wrappers
DomElement getDomElement() - Returns Dom element of the template
fcf.NClient.Wrapper getFirstChild() - Returns the first child wrapper of the template
string getId() - Returns template id
object getOptions() - Returns an object with template option values
fcf.NClient.Wrapper getParent() - Returns the parent wrapper
string getTemplate() - Returns template name
fcf.Actions initialize() - Initializes the object. After its execution, all child elements will also be initialized and ready for use.
bool isChild(fcf.NClient.Wrapper a_wrapper) - Returns true if the object is the owner of a_wrapper
bool isOwn(fcf.NClient.Wrapper a_wrapper) - Returns true if the object being checked is nested in the wrapper or is this object
lock() - Locks the template
recalculate() - Performs simplified argument recalculation. Only tokenizing arguments declared via fcf.argVal() are recalculated
fcf.Actions refresh() - Redraws the template and returns the arguments to the values equal to the initial values
fcf.Actions reload() - Redraws the template with a complete recalculation of the arguments. The initial values of the arguments are recalculated.
NodeList select(string a_selector) - Selects Dom elements inside the current template
fcf.Actions->mixed send(object a_data, [FileList|DomElement{input type=file}] a_files = undefined) - Performs the server-side action defined in the [TEMPLATE].receive.js file
unlock() - Unlocks the template
fcf.Actions update() - Recalculates and redraws the template based on the current state of the arguments. The update algorithm depends on the clientRendering template option.
validate(mixed a_value, object a_options, array a_dsterrors) - Checks the value for validity. The validation is performed based on template arguments, which are interpreted as the values of the SQL field description.
Methods
fcf.Actions attach() The method is called every time the template is linked to the wrapper. This method is used in inherited classes. Return value: fcf.Actions
array check() Validates the template data and returns an array of objects with error information Return value: array Array of objects with information about errors in validating data from the current state of the template

Object fields with error information:

  1. string id - template id
  2. string alias - template alias
  3. ErrorObject error - error object

destroy() Deletes the template and the data associated with it
Event emit(string|Event a_event, object a_data) Sends a Dom event to the wrapper Arguments: string|Event a_event - Event name or event object object a_data - An object with the values of additional event fields Return value: Event
DomElement getActionDomElement() Returns the Dom element of the template actions. The template's Dom events pass through this element. Return value: DomElement Dom element of template actions
string getAlias() Returns alias template Return value: string Alias template
mixed getArg(string a_path) Returns the value of the template argument Arguments: string a_path - The data path of the template argument. Path elements can be separated by a point or by an object element access format using the ["ELEMENT"] construct.

Examples:

wrapper.getArg('arg1')

wrapper.getArg('arg1.name')

wrapper.getArg('arg1["name"]')

Return value: mixed
object getArgs() Returns an object with the values of the template arguments Return value: object
fcf.NClient.Wrapper getChild(string a_alias) Returns the child wrapper by alias name Arguments: string a_alias - Alias of the child template Return value: fcf.NClient.Wrapper Child wrapper
[fcf.NClient.Wrapper] getChilds() Returns an array of child template wrappers Return value: [fcf.NClient.Wrapper] Array of child elements
DomElement getDomElement() Returns Dom element of the template Return value: DomElement
fcf.NClient.Wrapper getFirstChild() Returns the first child wrapper of the template Return value: fcf.NClient.Wrapper
string getId() Returns template id Return value: string template id
object getOptions() Returns an object with template option values Return value: object Object with template option values
fcf.NClient.Wrapper getParent() Returns the parent wrapper Return value: fcf.NClient.Wrapper Parent wrapper
string getTemplate() Returns template name Return value: string Template name
fcf.Actions initialize() Initializes the object. After its execution, all child elements will also be initialized and ready for use. Return value: fcf.Actions Promise object indicating completion of execution
bool isChild(fcf.NClient.Wrapper a_wrapper) Returns true if the object is the owner of a_wrapper Arguments: fcf.NClient.Wrapper a_wrapper - The object being checked Return value: bool
bool isOwn(fcf.NClient.Wrapper a_wrapper) Returns true if the object being checked is nested in the wrapper or is this object Arguments: fcf.NClient.Wrapper a_wrapper - The object being checked Return value: bool
lock() Locks the template
recalculate() Performs simplified argument recalculation. Only tokenizing arguments declared via fcf.argVal() are recalculated
fcf.Actions refresh() Redraws the template and returns the arguments to the values equal to the initial values Return value: fcf.Actions
fcf.Actions reload() Redraws the template with a complete recalculation of the arguments. The initial values of the arguments are recalculated. Return value: fcf.Actions
NodeList select(string a_selector) Selects Dom elements inside the current template Arguments: string a_selector - The selection rules defined by the method document.querySelectorAll() Return value: NodeList
fcf.Actions->mixed send(object a_data, [FileList|DomElement{input type=file}] a_files = undefined) Performs the server-side action defined in the [TEMPLATE].receive.js file Arguments: object a_data - Data sent to the server [FileList|DomElement{input type=file}] a_files - Array with FileList objects storing files sent to the server or DOM input elements of type file Return value: fcf.Actions->mixed Returns fcf.Actions with the result of processing data on the server side
setArg(string a_path, mixed a_value, bool a_ignoreCallbacks = false, bool a_ignoreRedrawing = false, bool a_innerCall = false) Sets the value of the template argument Arguments: string a_path - The data path of the template argument. Path elements can be separated by a point or by an object element access format using the ["ELEMENT"] construct.

Examples:

wrapper.setArg('arg1', 'new value')

wrapper.setArg('arg1.name', 'new value')

wrapper.setArg('arg1["name"]', 'new value')

mixed a_value - The specified value of the argument bool a_ignoreCallbacks - If set to true, the handlers for changing the onArg argument are not called bool a_ignoreRedrawing - If true, the template is not updated (it should not be rendered) bool a_innerCall - The parameter is passed to the onarg template argument handler to define an internal call from the wrapper code
unlock() Unlocks the template
fcf.Actions update() Recalculates and redraws the template based on the current state of the arguments. The update algorithm depends on the clientRendering template option. Values of the clientRendering template option:
  1. true - Rendering is performed on the client and only the template parameters of the value type that have not been changed are recalculated
  2. false - Rendering is performed on the server and only the template parameters that have not been changed are recalculated
Return value: fcf.Actions
validate(mixed a_value, object a_options, array a_dsterrors) Checks the value for validity. The validation is performed based on template arguments, which are interpreted as the values of the SQL field description. Arguments: mixed a_value - Value to check object a_options - Object of additional validation parameters.

Object fields

  1. bool secondPriority = false - If true the not Null constraints are ignored

array a_dsterrors - An array in which objects with information about validation errors are written.

Object fields with error information:

  1. string id - template id
  2. string alias - template alias
  3. ErrorObject error - error object