Syntax
dictionaryActions ::= [ dictionaryActionsItem+ ] dictionaryActionsItem ::= updateArray || deleteArray || createArray || updateObject || deleteObject updateArray ::= { id: identifier, search: searchObject, action: 'updateArray', index: number, currentElement: number || String || object newElement: number || String || object } deleteArray ::= { id: identifier, search: searchObject, action: 'deleteArray', index: number, currentElement: number || String || object } createArray ::= { id: identifier, search: searchObject, action: 'createArray', index: number, newElement: number || String || object } updateObject ::= { id: identifier, search: searchObject, action: 'updateObject', property: identifier, newElement: number || String || object } deleteObject ::= { id: identifier, search: searchObject, action: 'deleteObject', property: identifier } searchObject ::= [ searchObjectItem+ ] searchObjectItem ::= number || String || object
Some properties can not be set at once:
- To set the object to update use id or search, but not both.
- To set the item to create/update/delete use index or currentElement, but not both.
Description
The dictionaryActions
object is used to declare one or more actions to update the dictionary. It is a javascript object. ZPT-JS will also update HTML!
Important! This configuration option must be used beside update command. It the command is not update it will be ignored.
Nowadays there are 5 types of dictionary actions:
- updateArray. Updates an element of an array.
- deleteArray. Deletes an element of an array.
- createArray. Insert an element in an array.
- updateObject. Updates a property of an object.
- deleteObject. Deletes (unset) a property of an object.
To set the object to update we can use:
- The id property. The name of a simple variable in the dictionary.
- The search property. A path to find a variable through variables, array items and properties of objects.
The list of available properties of a dictionary actions is:
- id. The name of a simple variable in the dictionary.
- search. A path to find a variable through variables, array items and properties of objects.
- action. The type of dictionary action. Available options are updateArray, deleteArray, createArray, updateObject and deleteObject.
- index. Use it only for arrays. The index of the array element to create, update or delete.
- currentElement. Use it only for arrays. The element of the array to create, update or delete.
- newElement. The element to create or update.
- property. Use it only for objects. The property of the object to update or delete.
Examples
Go to tutorial to see some examples.