Table

The Table Class provides properties, methods, and events to interface with the HTML tags generated by the <silk:Table> tag.

Kind: global class

Properties

Name
Type
Description

$table

Object

jQuery object referencing to the table HTML tag.

$tableSearchInput

Object

jQuery object referencing the search text input element.

filterLoad

function

Function which evaluates if a row should be included in the If true is returned the row is added, false ignores the row. Get the paramters index and item.

Methods and Event

new Table(id, option)

Returns a Table instance.

Param
Type
Default
Description

id

String

Unique identifier.

option

Object

Object containing the configuration.

[option.dataSource]

String

Unique identifier of the dataProvider used to fill the

[option.autoSelect]

Boolean

true

If true the table will automatically load the data from the dataProvider. If false is will wait for the load command.

[option. targetPage]

String

Unique identifier of the page which will become active when a row is selected.

[option.header]

String

fixed

Defines the header location: fixed Attaches the header to the top of the page. inline Attaches the header to the top of the table location. none No header.

[option.treeData]

Boolean

false

Indicates if the data should be treated as a tree structure. If the dataProvider is selected as treeData=true then the table inherets the value.

[option.rootLabel]

String

The label used to display in the root row.

[option.noRoot]

Boolean

false

Defines if the Root will be an editable row. Default is NO.

[option.multiRoot]

Boolean

false

Defines if tree will support multiple root branches. Default is NO, just one root.

[option.iconOpen]

String

The icon showing an open branch if treeData if true. The default value is fas fa-minus-square from Fontawesome.

[option.iconClose]

String

The icon showing a close branch if treeData if true. The default value is fas fa-plus-square from Fontawesome.

[option.iconEmpy]

String

The icon showing an end branch if treeData if true. Empty by default.

[option.collapsable]

Integer

Indicates the tree can collapose.

[option.collapsedLevel]

Integer

Indicates the number of open levels. Other levels will remain closed.

[option.selectable]

Boolean

true

If true the row will change color when selected.

[option.dpSearch]

Boolean

false

If false the search is done in the loaded data. If true the search leads to a dataProvider reload. It can also received the name of the DataProvider to be loaded.

[option.input]

Boolean

false

If true it will create input fields for the configured columns.

[option.toggleList]

String

The list of comma separated elements which will be toggle together with the component.

addColumn(column)

Adds a column object to the columns array. This also adds the header.

Kind: instance method of Table

Param
Type
Description

column

Object

The column object

addComponent(component)

Adds a new component to the components array.

Kind: instance method of Table

Param
Type
Description

component

Object

The component object.

buildHeaders()

Generates the table's columns using the loaded Column objects.

Kind: instance method of Table

cleanColumns()

Clean the columns array.

Kind: instance method of Table

cleanHeaders()

Clean the headers from

Kind: instance method of Table

clearSearchText()

Clears the content of the search text input.

Kind: instance method of Table

filterLoad(index, item)

Function which evaluates if a row should be included in the If true is returned the row is added, false ignores the row.

Kind: instance method of Table

Param
Description

index

The record index.

item

The row object.

getColumns() ⇒ Array

Gets the columns array

Kind: instance method of Table

getComponents()

Gets the loaded component array.

Kind: instance method of Table

getDataSource()

Gets a reference to the dataSource.

Kind: instance method of Table

getInputs(inputProcessor) ⇒

Returns an array containing row object holding the inputs' object. If a function is provided this will be executed for each row. The function will received an opbject containging the inputs as a parameter

Kind: instance method of Table Returns: Array

Param
Description

inputProcessor

An optional function

getNoRoot() ⇒ Boolean

Returns if the table should limit the root.

Kind: instance method of Table

getPkColumn() ⇒ String

Gets the data primary key.

Kind: instance method of Table

getPkValue() ⇒ String

Gets the primary key's value of the selected row.

Kind: instance method of Table

getSearchText() ⇒ String

Get the text typed in the search text input.

Kind: instance method of Table

getSelectedItem(columnName) ⇒ Object | String

Returns the selected item object, or the column's' value if a columnName is provided.

Kind: instance method of Table

Param
Type
Description

columnName

String

The column's value to return. Optional.

hide()

Hides the button

Kind: instance method of Table

isTreeData() ⇒ Boolean

Returns if the table is set to evaluate a tree data structure.

Kind: instance method of Table

length() ⇒ Integer

Returns the number of tabler rows.

Kind: instance method of Table

load(action, index)

The method which load the data to fill the Table.

Kind: instance method of Table

Param
Type
Description

action

String

Indicating what action to load: insert, update, delete.

index

Integer

The position the data will be loaded.

on

Extends the "on" method from the eventManager Class.

Kind: instance property of Table

Param
Type
Description

eventName

String

The event's name.

eventFunction

function

The function to be triggered.

refreshRow(trIndex, dpIndex)

Reload the data for the selected row by default, or the indicated row.

Kind: instance method of Table

Param
Type
Description

trIndex

Integer

The row index within the table row.

dpIndex

Integer

The row index in the dataProvider.

removeColumn(column)

Removes a column object to the columns array. This also removes the header.

Kind: instance method of Table

Param
Type
Description

column

Object

The column object

selectRow(index)

Select table row bases on the table row index

Kind: instance method of Table

Param
Description

index

The table row index

selectUp()

Selects the row up from the currently selected row.

Kind: instance method of Table

setInputs(inputStatus)

Switch the column's input status, or will set the input to the provided status. This only works in columns set as input holders.

Kind: instance method of Table

Param
Description

inputStatus

The input status.

setRootLabel()

Sets the root label if treeData is true;

Kind: instance method of Table

setSearchText()

Sets the text of the search text input.

Kind: instance method of Table

setSelectedItem()

Sets the value of the provided column in the selected row.

Kind: instance method of Table

setTreeIcons(open, close, empty)

Sets the tree icons. This overwrites the default icons.

Kind: instance method of Table

Param
Type
Description

open

String

The icon representing the open status.

close

String

The icon representing the close status.

empty

String

The icon representing a final branch.

show()

Shows the button

Kind: instance method of Table

sort(column)

Sorts the data by the provided column

Kind: instance method of Table

Param
Type
Description

column

String

Column to sort

toggle(status)

Hides or shows the table based on the provided parameter.

Kind: instance method of Table

Param
Type
Description

status

boolean

True shows and false hides.

on:afterLoad

Event triggered after the table content is loaded. Created with the Table.on("afterLoad", function(){}) method.

Kind: event emitted by Table

on:beforeLoad

Event triggered before the table content is loaded. Created with the Table.on("beforeLoad", function(){}) method.

Kind: event emitted by Table

on:click (coldIndex, dbIndex, mouseEvent)

Event triggered when a row is clicked. Created with the Table.on("click", function(colIndex, dpIndex, mouseEvent){}) method.

Kind: event emitted by Table

Param
Type
Description

coldIndex

Integer

The column clicked. The first one is 0.

dbIndex

Integer

The dataProvider index of the selected row.

mouseEvent

Object

The mouse click even object.

on:dragDrop

Event triggered when a dragged row is dropped over a row area. It returns the column index, row index, data provider item, and the mouse event. Created with the Table.on("dragStart", function(columnIndex, rowIndex, dpItem, event ){}) method.

Kind: event emitted by Table

on:dragEnter

Event triggered when a dragged row enters another row area. It returns the column index, row index, data provider item, and the mouse event. Created with the Table.on("dragStart", function(columnIndex, rowIndex, dpItem, event ){}) method.

Kind: event emitted by Table

on:dragLeave

Event triggered when a dragged row leaves a row area. It returns the column index, row index, data provider item, and the mouse event. Created with the Table.on("dragStart", function(columnIndex, rowIndex, dpItem, event ){}) method.

Kind: event emitted by Table

on:dragOver

Event triggered when a dragged row is over another row area. It returns the column index, row index, data provider item, and the mouse event. Created with the Table.on("dragStart", function(columnIndex, rowIndex, dpItem, event ){}) method.

Kind: event emitted by Table

on:dragStart

Event triggered when a row starts being dragged. It returns the column index, row index, data provider item, and the mouse event. Created with the Table.on("dragStart", function(columnIndex, rowIndex, dpItem, event ){}) method.

Kind: event emitted by Table

on:error

Event triggered after an error. Created with the Table.on("error", function(){}) method.

Kind: event emitted by Table

on:renderInput

Event triggered before input is being generated. If the event's' function returns true the input will be created. If it returns false it will no render an input. If the event returns a text value this is used to define the input's' type and the input is generated. The text can contain an added mask separated by a pipe symbol. If the event returns undefined the input is generated. Created with the Table.on("renderInput", function(value,index,item){}) method.

Kind: event emitted by Table

on:dataInput

Event triggered while input is being generated. Created with the Table.on("dataInput", function(index,item,type){}) method. If the event's function returns an object this will be saved as a JSON String in the input's property 'data-json' to be used during data post operation.

Kind: event emitted by Table

Last updated