new Properties(configurator)
Provide an object to manipulate the propertues of the ADC (config.xml > properties)
const ADX = require('adxutil').ADX;
const myAdx = new ADX('path/to/adc/');
myAdx.load(function (err) {
if (err) {
throw err;
}
// Get the instance of the Properties
const properties = myAdx.configurator.properties;
console.log(properties.get());
});
Parameters:
Name | Type | Description |
---|---|---|
configurator |
ADX.Configurator | Instance of the configurator |
Members
-
configurator :Configurator
-
Parent configurator
Type:
Methods
-
get()
-
Get properties as an object
// Get the properties object adxProperties.get(); // { // categories : [{ // id : "general", // name : "General" // properties : [{ // id : "renderingType", // name : "Rendering Type", // type : "string", // description : "Type of the ADC rendering", // value : "classic", // options : [{ // value : "classic", // text : "Classical" // }, { // value : "image", // text : "Image" // }] // }] // }, { // id : "styles", // name : "Styles", // properties : [{ // id : "bg", // name : "Background color", // type : "color", // description : "Background color of the ADC", // colorFormat : "rgb", // value : "255,255,255" // }] // } // }
Returns:
- Type
- Object
-
set(data)
-
Set the properties using a plain object
// Get the properties object adxProperties.set({ categories : [ { id : "general", description : "General", properties : [ { id : "background", name : "Background color", type : "color", description : "Color of the ADC background", colorFormat : "rgb", value : "255,255,255" } ] } ] });
Parameters:
Name Type Description data
Object Data to set
Properties
Name Type Argument Description categories
Array.<Object> <optional>
Categories
Properties
Name Type Argument Description id
String <optional>
Id of the category
name
String <optional>
User friendly name of the category
properties
Array.<Object> <optional>
Properties of the category
Properties
Name Type Argument Description id
String <optional>
Id of the property
name
String <optional>
Name of the property
type
String | "number" | "boolean" | "string" | "color" | "file" | "question" <optional>
Type of the property
description
String <optional>
Description of the property
mode
String | "static" | "dynamic" <optional>
Reading mode of the property value
visible
Boolean <optional>
Visibility of the property value
require
Boolean <optional>
Requirement of the property value
pattern
String <optional>
Pattern of the string property
min
Number <optional>
Min value of the number property
max
Number <optional>
Max value of the number property
decimal
Number <optional>
Allowed decimal of the number property
chapter
Boolean <optional>
Allowed chapter for question property
single
Boolean <optional>
Allowed single-closed question for question property
multiple
Boolean <optional>
Allowed multi-coded question for question property
numeric
Boolean <optional>
Allowed numeric question for question property
open
Boolean <optional>
Allowed open-ended question for question property
date
Boolean <optional>
Allowed date/time question for question property
value
String <optional>
Default property value
options
Array.<Object> <optional>
List of options
Properties
Name Type Argument Description value
String <optional>
Value of the option
text
String <optional>
Text of the option to display
-
toXml()
-
Return the properties as xml string
// Serialize the properties to XML adxProps.toXml(); // -> <properties><category id="genereal" name="Genereal"> ...</properties>
Returns:
- Type
- String