vegui. list. class.jsSummary | | | | | | | | | | | | | | | | | These child elements are all accessable over *this.[child_name] even though they may not all be direct children of this element | | | | the sItem property holds the selected item in the form of an object. | | | | | | | | | | | | | | Adds a HTML node as a new item to the list with a certain value attached | | Wrapper function to add an item that contains an image and text | | Wrapper function to add an item that contains on text | | Adjusts the scrollbars of the list to the content over flow of the list. | | | | Closes the list if the list is a dropdown list | | Deselects the currently selected item(s), or the item submitted to the function. | | Drops the item that is located at the submitted index in the childNodes array of the Table child’s HTML node | | Sees if an item with a certain value exists | | Clears the list of all items | | Handles key press on the list element | | Checks if the item with a certain value is selected | | Expands the list if it is a dropdown list | | Selects the first item that has the requested value | | Selects the item with the submitted HTML node. | | Selects items from item with value1 to item with value2 | | Sets the most common template properties for the list | | Wrapper method to set the style class name attributes of this element | | Returns the index of an item in the sItems property | | Returns a string representation of the selection in the form of item values separated by a delimiter. | | Scrolls the list to make sure a certain item is in point of view of the user |
List Types| VUI_LISTTYPE_NORMAL | normal list | | VUI_LISTTYPE_DROPDOWN | drop down list | | VUI_LISTTYPE_MULTI | multi select list |
VegUIListSummary | | | | | | | These child elements are all accessable over *this.[child_name] even though they may not all be direct children of this element | | | | the sItem property holds the selected item in the form of an object. | | | | | | | | | | | | | | Adds a HTML node as a new item to the list with a certain value attached | | Wrapper function to add an item that contains an image and text | | Wrapper function to add an item that contains on text | | Adjusts the scrollbars of the list to the content over flow of the list. | | | | Closes the list if the list is a dropdown list | | Deselects the currently selected item(s), or the item submitted to the function. | | Drops the item that is located at the submitted index in the childNodes array of the Table child’s HTML node | | Sees if an item with a certain value exists | | Clears the list of all items | | Handles key press on the list element | | Checks if the item with a certain value is selected | | Expands the list if it is a dropdown list | | Selects the first item that has the requested value | | Selects the item with the submitted HTML node. | | Selects items from item with value1 to item with value2 | | Sets the most common template properties for the list | | Wrapper method to set the style class name attributes of this element | | Returns the index of an item in the sItems property | | Returns a string representation of the selection in the form of item values separated by a delimiter. | | Scrolls the list to make sure a certain item is in point of view of the user |
Hierarchyextends VegUIContentBox Inherits all properties and methods from VegUIContentBox VegUINode | +-- VegUIContentBox | +-- VegUIList
Dependencies| file | vegui.cbox.class.js | | file | vegui.scrollbar.class.js |
Child ElementsThese child elements are all accessable over *this.[child_name] even though they may not all be direct children of this element
Item Objectthe sItem property holds the selected item in the form of an object. The object’s structure is this: | sItem.node | the HTML node of the item | | sItem.itemValue | the value of the item |
Object Properties| items | int, number of items in the list | | sItem | Object, holds the currently selected item | | sItems | Array, holds the currently selected items if list is of type VUI_LISTTYPE_MULTI | | sValue | variable, holding the value of the currently selected item | | hItem | object, holds the currently hovered item | | expandedSize | int, height of the list if expanded (dropdown mode only) | | listType | int, List Types | | bSelectMode | bool, if true then list is currently in select mode where multiple items can be selected just be moving the mouse over them | | mNormal | string, css class to use for items while not selected and not hovered by mouse | | mOver | string, css class to use for items when mouse is hovering over them | | mClick | string, css class to use for selected items | | mOverSelected | string, css class to use for hovering over selected items | | mHeader | string, css class to use for header items | | blockTextSelection | bool, true by default, prevents text selection in the cells | | blockKeyScrolling | bool, if true prevents scrolling via arrow keys |
Template Properties| T.itemHeight | int, row height (pixels) | | T.h | int, in addition of being the height of the list it also sets the expandedSize property (pixels) | | T.rowSpace | int, space between two rows (pixels) | | T.listType | int, listType | | T.nullEntry | bool, if true the item ‘-’ with value null will be added to the beginning of the list | | T.mNormal | mNormal | | T.mOver | mOver | | T.mClick | mClick | | T.mHeader | mHeader | | T.mOverSelected | mOverSelected |
add_item| this.add_item = function( | node, | | value, | | dontAdjust, | | asHeader, | | replace | ) |
|
Adds a HTML node as a new item to the list with a certain value attached Parameters| HTMLNode node | the html node you want to add as item to the list | | variable value | the value you want to attach to the item | | <bool dontAdjust> | prevents adjust method from being called after the item is added | | <bool asHeader> | if true the item will be added as header and will not be selectable | | <bool replace> | if true and the submitted value already exists in the list the item at the current value will be replace by the newly created item |
Code examplemyList.add_item(document.getElementById('somenode'), 1);
myList.add_item(document.getElementById('somenode'), 0, false, true);
See alsodrop_item, add_item_txt, add_item_imgtxt
add_item_imgtxt| this.add_item_imgtxt = function( | src, | | txt, | | value, | | dontAdjust, | | asHeader, | | replace | ) |
|
Wrapper function to add an item that contains an image and text Parameters| string src | path of the image to embed | | string txt | text that appears beside the image | | variable value | value to attach to the item | | <bool dontAdjust> | prevents the call of the adjust method | | <bool asHeader> | if true item will be added as header | | <bool replace> | if true and the submitted value already exists in the list the item at the current value will be replace by the newly created item |
See alsoadd_item, add_item_txt ExampleList.add_item_imgtxt('image.gif', 'Some Image', 1);
add_item_txt| this.add_item_txt = function( | txt, | | value, | | dontAdjust, | | asHeader, | | replace | ) |
|
Wrapper function to add an item that contains on text Parameters| string txt | text of the item | | variable value | value to attach to the item | | <bool dontAdjust> | prevents the call of the adjust method | | <bool asHeader> | if true item will be added as header | | <bool replace> | if true and the submitted value already exists in the list the item at the current value will be replace by the newly created item |
See alsoadd_item, add_item_imgtxt ExampleList.add_item_txt('List Entry', 1);
adjustAdjusts the scrollbars of the list to the content over flow of the list. This is usually called everytime an item is added to the list at runtime.
build_list| this.build = this.build_list = function( | toNode | ) |
|
Builds the list private function You should always use VegUIManager::build_element to build VegUI elements. Parameters| <HTMLNode toNode> | if submitted the created HTML node will be appended to toNode |
Returns| null | on failure | | int | 1 on success |
See ParentVegUINode::build_node
closeCloses the list if the list is a dropdown list See alsoopen ExampleList.close();
deselect_item| this.deselect_item = function( | value, | | noOnChange | ) |
|
Deselects the currently selected item(s), or the item submitted to the function. private function Parameters| <variable value> | if submitted the item with this value will be deslected only (multi selection list) | | <bool noOnChange> | if true onchange() will not be called |
See alsoselect, select_item
drop_item| this.drop_item = function( | index | ) |
|
Drops the item that is located at the submitted index in the childNodes array of the Table child’s HTML node Parameters| int index | index of the item’s HTML node in this.Table.Base.childNodes |
See alsoadd_item ExampleList.drop_item(0);
List.drop_item(9);
find| this.find = function( | value | ) |
|
Sees if an item with a certain value exists Parameters| variable value | value to search for |
Returns| int | returns the index of the HTMLnode of the item in the childNodes Array of the Table child | | bool | returns false if no item with the requested value was found |
See alsois_selected Examplereturn List.find(1);
List.drop_item(List.find(1));
flushClears the list of all items ExampleList.flush();
handle_key_list()| this.handle_key = this.handle_key_list = function() |
Handles key press on the list element private function Alias<handle_key> See also<VegUICBox::handle_key_cbox>
is_selected| this.is_selected = function( | value | ) |
|
Checks if the item with a certain value is selected Parameters| variable value | value to check for |
See alsoselect, find Returns| bool | true if value is currently selected, false if not |
Example return List.is_selected(1);
openExpands the list if it is a dropdown list See alsoclose
select| this.select = function( | value, | | noOnChange | ) |
|
Selects the first item that has the requested value Parameters| variable value | value to search for | | bool noOnChange | prevents the VegUINode::onchange event from being triggered |
See alsoselect_item, deselect_item ExampleList.select(1);
select_item| this.select_item = function( | node, | | noOnChange, | | append | ) |
|
Selects the item with the submitted HTML node. This is a private function that is called whenever an item is clicked to mark it as selected. If you want to select an item manually you should use the select method private function Use select method to select item by value Parameters| HTMLNode node | node of the item to be selected | | <bool noOnChange> | will prevent the call of VegUINode::onchange | | <bool append> | if true current selected item will not be deselected and the new selection will be appended (multiselection list only) |
select_items| this.select_items = function( | value1, | | value2 | ) |
|
Selects items from item with value1 to item with value2 Parameters| variable value1 | value of an item in the list | | variable value2 | value of an item in the list |
Returns| int | number of items selected |
See alsoselect_item, select, is_selected Example List.select_items(1,20);
set_list| this.set = this.set_list = function( | w, | | h, | | x, | | y, | | ih, | | rs, | | type, | | z, | | ne | ) |
|
Sets the most common template properties for the list Aliasset() Parameters| int w | width (pixels) | | int h | height (pixels) | | int x | x position (pixels) | | int y | y position (pixels) | | int ih | item height (pixels) | | int rs | row space, the space between two rows (pixels) | | int type | list type List Types | | int z | z index | | bool ne | enable or disable null entry |
See ParentVegUINode::set_node Example List.set_list(150,200,5,5,16,0,VUI_LISTTYPE_NORMAL);
List.set_list(150,200,5,5,0,0,VUI_LISTTYPE_NORMAL);
List.set_list(150,200,5,5,16,0,VUI_LISTTYPE_MULTI);
List.set_list(150,200,5,5,16,0,VUI_LISTTYPE_DROPDOWN);
set_style_list| 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 Aliasset_style Parameters| string over | css class to use on a row when the mouse is hovering over it | | string normal | css class to use on a row when in normal state | | string select | css class to use on a row when selected | | string header | css class to use on header rows | | string overSelect | css class to use on a row when the mouse is hovering over it and the row is selected |
sitem_idx| this.sitem_idx = function( | value | ) |
|
Returns the index of an item in the sItems property Parameters| variable value | value of the item to search for |
Returns| int | -1 if no item was found | | int | index of the item in the sItems array if it was found |
to_string| this.to_string = function( | sep | ) |
|
Returns a string representation of the selection in the form of item values separated by a delimiter. This is useful for processing multi selections. Parameters| <string sep> | seperator string between each item, ‘,’ default |
Returns| string | string representation of selections |
Example return List.to_string(',');
warp| this.warp = function( | value | ) |
|
Scrolls the list to make sure a certain item is in point of view of the user Parameters| int value | value of the item to warp to |
Example List.warp(1);
|