ia.Table Class
A class for rendering a data table.
Constructor
ia.Table
-
id
Parameters:
-
id
StringThe id of the table.
Item Index
Methods
Methods
_addMouseEvents
-
obj
Adds mouse events to the passed jquery object. Uses delegation to reduce number of events added to rows and rendering time!
Parameters:
-
obj
JQUERY ElementThe jquery object.
_dispatchItemEvent
-
id
-
eventType
-
state
Dispatches item events.
Parameters:
-
id
StringThe id.
-
eventType
StringThe event type.
-
state
StringThe state.
_getColumnIndex
-
colId
Returns the column index for the given column id.
Parameters:
-
colId
StringThe column id.
Returns:
_scrollIntoView
-
element
Scrolls a row into view.
Parameters:
-
element
JQUERY ElementThe row as a jquery object.
_size
()
private
Sizes all the element to make the scrolling work.
addEventListener
-
eventType
-
fnc
-
obj
Add an event listener.
Parameters:
-
eventType
StringThe type of event to listen for.
-
fnc
FunctionThe function to call when the event occurs.
-
obj
ObjectAn optional parent object.
clearHighlight
()
Clears all highlights.
clearSelection
()
Clears all selections.
dispatchEvent
-
event
Dispatch an event to the listeners.
Parameters:
-
event
ObjectThe event object.
exportData
-
txt
Exports as an image in a new page.
Parameters:
-
txt
StringAny text to go with image.
getData
()
Id:"eh11", name:"polwarth", value:2345, associate1:25
Gets a data object for the table.
Returns:
highlight
-
rowId
Hightlights a row.
Parameters:
-
rowId
StringThe id of the row to select.
promoteToTop
-
ids
Promotes a list of row ids to the the top of the table.
Parameters:
-
ids
StringThe list of ids.
removeListener
-
obj
Removes all event listeners for the given object.
Parameters:
-
obj
ObjectThe object.
render
()
Renders the table.
renderSelection
()
Renders the selection.
select
-
rowId
Selects a row.
Parameters:
-
rowId
StringThe id of the row to select.
selectText
()
Selects all the text in the table.
setData
-
value
Sets a data object for the table.
Parameters:
-
value
Id:"eh11", name:"polwarth", value:2345, associate1:25["eh11"]
["eh12"]{id:"eh12", name:"morningside", value:4347, associate1:45}
["eh13"]{id:"eh13", name:"merchiston", value:2496, associate1:25}
sort
-
colIndex
-
sortDirection
Sorts the table. The table must be rendered before it can be sorted.
Parameters:
-
colIndex
NumberThe id of the column to sort by.
-
sortDirection
StringThe sort direction "ascending" or "descending". Default is "ascending".
stickToTop
-
ids
Sticks a list of row ids to the the top of the table.
Parameters:
-
ids
StringThe list of ids.
unselect
-
rowId
Unselects a row.
Parameters:
-
rowId
StringThe id of the row to unselect.
Properties
allowUserSorting
Boolean
Should user sorting be allowed.
Default: true
columns
JSON
The columns to be rendered.
The columns are an array with the following structure: They dictate which columns should be used from the data. The id points to the id in the data.
[{id:"name", label:"Features", type:"categoric'"}, {id:"value", label:"Indicator", type:"numeric'"}, {id:"associate1", label:"Associate 1", type:"numeric'"}, {id:"associate2", label:"Associate 2", type:"categoric'"}]
container
JQUERY Element
The container that holds the object.
highlightColor
String
The item highlight color.
id
String
The id.
selectionColor
String
The item selection color.
showLegendColor
Boolean
Should the legend color be displayed.
Default: true