SelectableElements

A class that allows children of the element to be selected.

Syntax

new SelectableElements(oElement, bMultiple);

Parameters

NameTypeDescripton
oElementHTMLElementThe element which children should be selectable.
bMultipleBooleanWhether to allow multiple selection or not.

Static Methods

NameDescription
None.

Static Fields

NameTypeDescripton
None.

Methods

NameDescription
click

Syntax

object.click(e)

Arguments

NameTypeDescripton
eEventThe event object associated with the click event.

Return Type

void

Called when the user clicks on the element.
fireChange

Syntax

object.fireChange()

Arguments

NameTypeDescripton

Return Type

void

Fires the pseudo event change.
getItem

Syntax

object.getItem(nIndex)

Arguments

NameTypeDescripton
nIndexNumberThe index of the item to return.

Return Type

HTMLElement

Returns the nIndex:th item. Part of the Indexable interface.
getItemIndex

Syntax

object.getItemIndex(el)

Arguments

NameTypeDescripton
elHTMLElementThe element to return the index for

Return Type

Number

Returns the index of a given item element. Part of the Indexable interface.
getItems

Syntax

object.getItems()

Arguments

NameTypeDescripton

Return Type

HTMLElements[]

Returns an array/collection containing all the items. Part of the Indexable interface.
getItemSelected

Syntax

object.getItemSelected(oEl)

Arguments

NameTypeDescripton
oElHTMLElementThe element to check whether selected or not.

Return Type

Boolean

Returns whether the element acting as item is selected.
getNext

Syntax

object.getNext(el)

Arguments

NameTypeDescripton
elHTMLElementThe element to get the next after.

Return Type

HTMLElement

Returns the next item after the one passed as argument. Returns null if no more items are available. Part of the Traversable interface.
getPrevious

Syntax

object.getPrevious(el)

Arguments

NameTypeDescripton
elHTMLElementThe element to get the previous before.

Return Type

HTMLElement

Returns the previous item before the one passed as argument. Returns null if no more items are available. Part of the Traversable interface.
getSelectedIndexes

Syntax

object.getSelectedIndexes()

Arguments

NameTypeDescripton

Return Type

Number[]

Returns an array containing the indexes of the selected items.
getSelectedItems

Syntax

object.getSelectedItems()

Arguments

NameTypeDescripton

Return Type

HTMLElement[]

Returns an array containing the HTMLElements that are selected.
isBefore

Syntax

object.isBefore(n1, n2)

Arguments

NameTypeDescripton
n1HTMLElementThe element to test if it is before the other
n2HTMLElementThe element to test if it is after the other

Return Type

Boolean

Returns whether the first argument comes before the second argument in the logical order of the items. Part of the Traversable interface.
isItem

Syntax

object.isItem(node)

Arguments

NameTypeDescripton
nodeNodeThe DOM node to test.

Return Type

Boolean

Returns whether the Node is considered an item or not.
setItemSelected

Syntax

object.setItemSelected(oEl, bSelected)

Arguments

NameTypeDescripton
oElHTMLElementThe element acting as item to select or deselect.
bSelectedBooleanWhether to select or deselect.

Return Type

void

Selects or deselects an item.
setItemSelectedUi

Syntax

object.setItemSelectedUi(oEl, bSelected)

Arguments

NameTypeDescripton
oElHTMLElementThe element acting as item to update visually.
bSelectedBooleanWhether to select or deselect.

Return Type

void

Updates the UI for the item.

Fields

NameTypeDescripton
None.

Events

NameDescripton
changeFires when the selection changes

Remarks

None.

SelectableTableRows

This class extends SelectableElements and therefore all methods and field available for SelectableElements are also available for SelectableTableRows.

A class that allows table rows to be selected in a table.

Syntax

new SelectableTableRows(oTableElement, bMultiple);

Parameters

NameTypeDescripton
oTableElementHTMLTableElementThe table element which rows should be selectable.
bMultipleBooleanWhether to allow multiple selection or not.

Static Methods

NameDescription
None.

Static Fields

NameTypeDescripton
None.

Methods

NameDescription
None.

Fields

NameTypeDescripton
None.

Events

NameDescripton
None.

Remarks

None.

SelectableTableCells

This class extends SelectableElements and therefore all methods and field available for SelectableElements are also available for SelectableTableCells.

A class that allows table cells to be selected in a table.

Syntax

new SelectableTableCells(oTableElement, bMultiple);

Parameters

NameTypeDescripton
oTableElementHTMLTableElementThe table element which cells should be selectable.
bMultipleBooleanWhether to allow multiple selection or not.

Static Methods

NameDescription
None.

Static Fields

NameTypeDescripton
None.

Methods

NameDescription
None.

Fields

NameTypeDescripton
None.

Events

NameDescripton
None.

Remarks

None.

SelectableListItems

This class extends SelectableElements and therefore all methods and field available for SelectableElements are also available for SelectableListItems.

A class that allows list items in a list to be selected.

Syntax

new SelectableListItems(oListElement, bMultiple);

Parameters

NameTypeDescripton
oListElementHTMLElementThe list element which list items should be selectable.
bMultipleBooleanWhether to allow multiple selection or not.

Static Methods

NameDescription
None.

Static Fields

NameTypeDescripton
None.

Methods

NameDescription
None.

Fields

NameTypeDescripton
None.

Events

NameDescripton
None.

Remarks

None.

Globals

Functions

NameDescription
addClassName

Syntax

addClassName(el, sClassName)

Arguments

NameTypeDescripton
elHTMLElementThe element to change the class name for.
sClassNameStringThe string to add to the class name.

Return Type

void

Adds a string to the class name of an element
removedClassName

Syntax

removedClassName(el, sClassName)

Arguments

NameTypeDescripton
elHTMLElementThe element to change the class name for.
sClassNameStringThe string to remove from the class name.

Return Type

void

removes a string from the class name of an element

Objects

NameTypeDescripton
None.

Introduction
Usage
Sub Classes
API
Demo
Download

Author: Erik Arvidsson