vegui. dataset. class.js

Summary
VegUI element type for VegUIDataset
This element extends the VegUIList element and thereby inherits all the properties and methods of the VegUIList
Builds the element
Creates a HTML node for a row in the dataset
Remove one item from the dataset by its row id
Remove multiple items from the dataset by their row ids
Dummy function, is called when the delete key is hit, this could be replaces by a function that sends a request to the server instead of calling delete_item right away
Dummy function, is called when the delete key is hit and multiple items are selected, this could be replaced by a function that sends a request to the server instead of calling delete_item right away
Expands the currently selected row and shows the content stored in the detailed field of the row
Toggles input mode on a column field in a certain row
Stops input mode
Flushes the dataset, removing all entries
Rebuilds the dataset according to the current data in columns and rows
Adds a row to the rows array
Returns the fields object for the row with the submitted id
Rebuilds the submitted row in the dataset
Wrapper method to set the style class name attributes of this element
Returns the data set as a valid xml string

Constants

VUI_DATASET

VegUI element type for VegUIDataset

Dataset Input Types

VUI_DSET_INPUT_TEXTtext input
VUI_DSET_INPUT_LISTlist input
VUI_DSET_INPUT_BOOLboolean input (true / false)
VUI_DSET_INPUT_CUSTOMcustom function input

VegUIDataset

This element extends the VegUIList element and thereby inherits all the properties and methods of the VegUIList

Hierarchy

VegUINode
|
+-- VegUICBox
|
+-- VegUIList
|
+-- VegUIDataset

Type

VUI_DATASET

Children

ControlVUI_NODE, used to control various html nodes
FldInputVUI_NODE, input node for regular text input
FldInputPwVUI_NODE, input node for password input
ListPanelVUI_NODE, panel that is shown when the user is is prompted for list input
ScalerVUI_NODE, node that will be used to visualize the scale effect when ListPanel is shown
Summary
Builds the element
Creates a HTML node for a row in the dataset
Remove one item from the dataset by its row id
Remove multiple items from the dataset by their row ids
Dummy function, is called when the delete key is hit, this could be replaces by a function that sends a request to the server instead of calling delete_item right away
Dummy function, is called when the delete key is hit and multiple items are selected, this could be replaced by a function that sends a request to the server instead of calling delete_item right away
Expands the currently selected row and shows the content stored in the detailed field of the row
Toggles input mode on a column field in a certain row
Stops input mode
Flushes the dataset, removing all entries
Rebuilds the dataset according to the current data in columns and rows
Adds a row to the rows array
Returns the fields object for the row with the submitted id
Rebuilds the submitted row in the dataset
Wrapper method to set the style class name attributes of this element
Returns the data set as a valid xml string

Properties

Object Properties

columnsobject, columns object that holds information about the columns in the dataset
rowsarray, array that holds a fields object for each row, every fields object holds a value for a certain column in the row
cssColumnOverstring, css class to use for a column field when mouse pointer is moved over it
cssColumnNormalstring, css class to use for a column field
cssRowstring, css class to use for a row (‘table element’)
cssDetailedstring, css class to use for detailed box
noFXbool, if true the detailed display will be faded in
fxFadeSpeedint, time it takes for the detailed display to fade in (ms)
ListTplVegUIList, the list for list input will be cloned from this template
fixColsbool, if true columns in the database will not resize in order to hold more content, any overflowing content will be cut
forceExpandbool, if true all items will be expanded after rebuild() is done

Template Properties

T.columnscolumns
T.rowsrows
T.multiSelectbool, if true multi selection of items is possible
T.cssColumnOvercssColumnOver
T.cssColumnNormalcssColumnNormal
T.cssRowcssRow
T.cssDetailedcssDetailed
T.noFXnoFX
T.fxFadeSpeedfxFadeSpeed
T.fixColsfixCols
T.forceExpandforceExpand

The Columns Object Explained

The columns object defines what and how many columns are in the dataset and how the user can interact with them.  Some of the keywords should be familiar from the VegUIPropertySet element.

Every property object of the columns object defines a column, the property name equals the column’s name.  Every column object can have certain properties set to define its behaviour

Column Properties

editTypeint, input type for the column
widthint, width of the column in percent
captionstring, caption text to display in the header of the column
passwordbool, if true content will be hidden and input will be password type input
fetchfunction, if editType is VUI_DSET_INPUT_CUSTOM this function will be called to update the field
fill_listfunction, if editType is VUI_DSET_INPUT_LIST this function will be called to fill the field’s list with items to chose from
valuevariable, if set defines the default value of the field
hiddenbool, if true the column will not be rendered (useful if you want to manipulate the detailed field, without having an additional detailed column show up in the dataset)
rawbool, property that is specific to the detailed field, if true the detailed field will hold raw text instead of displaying HTML

Columns Object Example

columns = {
column_1 : {
caption : 'First Column',
width : 50
},
column_2 : {
caption : 'Second Column',
width : 50
}
}

Fields Object Explained

A fields object holds the values for all the columns for a certain row.  Each property name of the object should be a match to one column of the dataset, the value of the property is the value of the column (field) in the row that is represented by the fields object.

The id property of a fields object is special, as it will represent a unique id of the row and the item that is getting added to the database list that represents the row will take over the value stored in the field object’s id property

The detailed property of a fields object is special, as it can hold a lot of text that will be hidden until the row is expanded using the expand function

Fields Object Example

fields = {
column_1 : 'field value 1',
column_2 : 'field value 2'.
id : n
};

Functions

build_dataset

this.build_dataset = this.build = function(toNode)

Builds the element

See also

VegUINode::build_node

create_entry

this.create_entry = function(fields,
asHeader)

Creates a HTML node for a row in the dataset

Paramters

object fieldsjavascript objects holding the field data of the row
<bool asHeader>if true create header element

Example of fields object

fields = {
column_1 : 'field value 1',
column_2 : 'field value 2'
};

delete_item

this.delete_item = function(value)

Remove one item from the dataset by its row id

Method

variable valuevalue of item to delete

delete_items

this.delete_items = function(sItems)

Remove multiple items from the dataset by their row ids

Method

array sItemsarray holding all selected items in the dataset

See also

delete_req

delete_req

this.delete_req = function(value)

Dummy function, is called when the delete key is hit, this could be replaces by a function that sends a request to the server instead of calling delete_item right away

Paramters

variable valueid of row that is to be deleted

See also

delete_item, delete_req_m

delete_req_m

this.delete_req_m = function(sItems)

Dummy function, is called when the delete key is hit and multiple items are selected, this could be replaced by a function that sends a request to the server instead of calling delete_item right away

Parameters

array sItemsarray holding items in the sItem format

See also

delete_items, delete_req

expand

this.expand = function(id)

Expands the currently selected row and shows the content stored in the detailed field of the row

input_go

this.input_go = function(id,
cell)

Toggles input mode on a column field in a certain row

Parameters

variable idid of the targeted row
HTMLNode celltargeted column field

Returns

nullif input could not be toggled on

input_halt

this.input_halt = function()

Stops input mode

Returns

variablethe new value entered by the user

See also

input_go

flush_dset

this.flush_dset = function()

Flushes the dataset, removing all entries

rebuild

this.rebuild = function()

Rebuilds the dataset according to the current data in columns and rows

row_add

this.row_add = function(fields,
id)

Adds a row to the rows array

Parameters

object fieldsfields object containing values for the columns in the row
variable idunique id for the row

See also

row_get

row_get

this.row_get = function(rowId,
getIdx)

Returns the fields object for the row with the submitted id

Parameters

int rowIdid of the row
bool getIdxif true only the index is returned

Returns

objectfields object
nullif no row with the submitted rowId was found
intindex, the index of the row object in the rows property when getIdx is submitted as true

See also

row_add

row_update

this.row_update = function(fields)

Rebuilds the submitted row in the dataset

Paramters

object fieldsfields object holding values for every column in the row

set_styles_dset

Wrapper method to set the style class name attributes of this element

Alias

set_styles

Parameters

string overcss class to use on a row when the mouse is hovering over it
string normalcss class to use on a row when in normal state
string selectcss class to use on a row when selected
string headercss class to use on header rows
string overSelectcss class to use on a row when the mouse is hovering over it and the row is selected
string colNormalcss class to use on a column field when in normal state
string colOvercss class to use on a column field when the mouse is hovering over it
string detailcss class to use for the detailed display

See also

VegUIList::set_style_list

to_xml

this.to_xml = function(tag)

Returns the data set as a valid xml string

Parameters

string tagname of the starting xml tag

Returns

stringxml string containing the rows of the data set
This element extends the VegUIList element and thereby inherits all the properties and methods of the VegUIList
this.build_dataset = this.build = function(toNode)
Builds the element
this.create_entry = function(fields,
asHeader)
Creates a HTML node for a row in the dataset
this.delete_item = function(value)
Remove one item from the dataset by its row id
this.delete_items = function(sItems)
Remove multiple items from the dataset by their row ids
this.delete_req = function(value)
Dummy function, is called when the delete key is hit, this could be replaces by a function that sends a request to the server instead of calling delete_item right away
this.delete_req_m = function(sItems)
Dummy function, is called when the delete key is hit and multiple items are selected, this could be replaced by a function that sends a request to the server instead of calling delete_item right away
this.expand = function(id)
Expands the currently selected row and shows the content stored in the detailed field of the row
this.input_go = function(id,
cell)
Toggles input mode on a column field in a certain row
this.input_halt = function()
Stops input mode
this.flush_dset = function()
Flushes the dataset, removing all entries
this.rebuild = function()
Rebuilds the dataset according to the current data in columns and rows
object, columns object that holds information about the columns in the dataset
array, array that holds a fields object for each row, every fields object holds a value for a certain column in the row
this.row_add = function(fields,
id)
Adds a row to the rows array
this.row_get = function(rowId,
getIdx)
Returns the fields object for the row with the submitted id
this.row_update = function(fields)
Rebuilds the submitted row in the dataset
this.to_xml = function(tag)
Returns the data set as a valid xml string
VegUI element type for VegUIDataset
string, css class to use for a column field when mouse pointer is moved over it
string, css class to use for a column field
string, css class to use for a row (‘table element’)
string, css class to use for detailed box
bool, if true the detailed display will be faded in
int, time it takes for the detailed display to fade in (ms)
bool, if true columns in the database will not resize in order to hold more content, any overflowing content will be cut
bool, if true all items will be expanded after rebuild() is done
A property set element, that has name value pairs and lets the user set the value via different methods
custom function input
list input
this.build = this.build_node = function(toNode,
takeNode)
build a HTML node from the template properties of this element.
this.set_style_list = this.set_style = function(over,
normal,
select,
header,
overSelect)
Wrapper method to set the style class name attributes of this element