vegui. propertyset. class.jsSummary | | | | | | | | | A property set element, that has name value pairs and lets the user set the value via different methods | | | | | | All these children are accessable over this.[child_name] even if they may not be direct children of the element | | The field object is used to populate the property set with name value pairs. | | | | | | | | | | | | | | | | | | | | | | Adds a single field to the property set list | | Builds the property set from a fields object. | | Cancels the input for a certain field, toggling input mode off and reverting it to its old value | | Toggles input mode for a field in the property set list on or off | | Updates the value of a single valid field object | | Clears the property set, effectivly removing all name values pairs | | Sets the most common template properties for the property set | | Returns the property set as a valid xml string |
Field Input Types| VUI_PSET_INPUT | generic input text field | | VUI_PSET_LIST | VegUIList as input | | VUI_PSET_CHECK | VegUICheckBox as input | | VUI_PSET_CUSTOM | custom function as input |
VegUIPropertySetA property set element, that has name value pairs and lets the user set the value via different methods Summary | | | | | All these children are accessable over this.[child_name] even if they may not be direct children of the element | | The field object is used to populate the property set with name value pairs. | | | | | | | | | | | | | | | | | | | | | | Adds a single field to the property set list | | Builds the property set from a fields object. | | Cancels the input for a certain field, toggling input mode off and reverting it to its old value | | Toggles input mode for a field in the property set list on or off | | Updates the value of a single valid field object | | Clears the property set, effectivly removing all name values pairs | | Sets the most common template properties for the property set | | Returns the property set as a valid xml string |
Hierarchyextends VegUIContentBox Inherits all properties and methods from VegUIContentBox VegUINode | +--> VegUIContentBox | +--> VegUIPropertySet
Child ElementsAll these children are accessable over this.[child_name] even if they may not be direct children of the element
Field Object ExplainedThe field object is used to populate the property set with name value pairs. It should have one property for each field, the property name should be the fields name and be a javascript object. Each field can have several sub properties that define its behaviour in regards to the property set Sometimes the documentation will talk about Single Valid Field Objects , which means a single field object. Like the field_1 object in the code example below.
Valid field properties| name | string, the name of the field | | value | variable, predefined value of the field | | type | int, input type of the field. Field Input Types | | fill_list | function, if input type is VUI_PSET_LIST, this function will be called to populate the liss that pops up | | fetch | function, if input type VUI_PSET_CUSTOM, this function will be called to return the value | | caption | string, if set this will be displayed in the name column instead of the actual field name | | oncancel | function, executed when input is canceled on field | | isPassword | bool, if true a password input field will be shown instead of a regular input field | | is_large | int, if >0, the input field will be a text area with n height | | disabled | bool, if true, input can not be toggled for this field | | xml_type | int, if 1, to_xml will output this field as it’s own tag instead of as an attribute of the main tag |
Code example of a valid fields objectfields = { field_1 : { name : 'field_1', value : 'some string', type : VUI_PSET_INPUT, caption : 'A field' } }
Object Properties| fields | Object, field information object | | listX | int, x offset for list popup | | listY | int, y offset for list popup | | ListTemplate | VegUIList, all lists will be cloned from this template | | cssName | string, css class to use for the name column | | cssValue | string, css class to use for the value column | | nameWidth | int, width of the name column (percentage) |
VegUIPropertySet| function VegUIPropertySet( | refName, | | Parent, | | Manager | ) |
|
constructor See ParentVegUINode::VegUINode
build_propset| this.build = this.build_propset = function( | toNode | ) |
|
Builds the property set private function You should always use VegUIManager::build_element to build a vegUI element Aliasbuild() Parameters| <HTMLNode toNode> | if submitted the created html node will be appended to toNode |
Returns| int | 1 on success | | null | on failure |
See ParentVegUINode::build_node
dataset_add| this.dataset_add = function( | fld | ) |
|
Adds a single field to the property set list private function ParametersSee alsodataset_build, dataset_update
dataset_build| this.dataset_build = function( | fields | ) |
|
Builds the property set from a fields object. Field Object Explained Parameters| Object fields | valid fields object containing 1 or more fields |
See alsodataset_add, flush Example fields = { field_1 : { name : 'field_1', type : VUI_PSET_INPUT, value : 'some default value', caption : 'Field 1' }, field_2 : { name : 'field_2', type : VUI_PSET_CHECK, value : false, caption : 'Is this true?' } };
Dataset.dataset_rebuild(fields);
dataset_cancel_input| this.dataset_cancel_input = function( | newValue | ) |
|
Cancels the input for a certain field, toggling input mode off and reverting it to its old value Parameters| <variable newValue> | if submitted this will be the new value of the field instead of its original value |
See also<tgl_input>
dataset_tgl_input| this.dataset_tgl_input = function( | fld, | | b | ) |
|
Toggles input mode for a field in the property set list on or off Parameters| Object fld | single valid field object that needs to exist in the fields property. | | bool b | turn input on or off for the submitted field |
See alsodataset_cancel_input ExampleDataset.dataset_tgl_input(Dataset.fields.field_2, true);
dataset_update| this.dataset_update = function( | fld, | | newValue | ) |
|
Updates the value of a single valid field object Parameters| Object fld | single valid field object. <Field Types Explained> | | variable newValue | new value |
See alsodataset_cancel_input Example Dataset.dataset_update(Dataset.fields.field_2, 'some text');
flushClears the property set, effectivly removing all name values pairs Also clears the fields property
set_propset| this.set = this.set_propset = function( | w, | | h, | | x, | | y, | | nameWidth, | | fields, | | listX, | | listY, | | cssTable, | | cssName, | | cssValue, | | itemHeight | ) |
|
Sets the most common template properties for the property set Aliasset() Parameters| int w | width (pixels) | | int h | height (pixels) | | int x | x position (pixels) | | int y | y position (pixels) | | int nameWidth | width of the name column (percentage) | | Object fields | fields object. Field Object Explained | | int listX | x offset for input lists (pixels) | | int listY | y offset for input lists (pixels) | | string cssTable | CSS class to use for the Table element | | string cssName | CSS class to use for the name column | | string cssValue | CSS class to use for the value column |
See ParentVegUINode::set_node
to_xml| this.to_xml = function( | tag | ) |
|
Returns the property set as a valid xml string Parameters| string tag | name of the starting xml tag |
Returns| string | xml string containing the data of the property set |
Examplevar xml = Dataset.to_xml('mydata');
|