DataGrid

DataGrid

new DataGrid()

Main DataGrid class constructor

Methods

(private, static) _checkNavPosition()

Check the Search and Action panel positions and create the elements in the desired position within the dataGrid

(private, static) _checkScrollState()

Determines whethere the table is scrollable in a vertical and horzontal manor an either uses the standard browser scroller or the custom scrollbar AIM component

(private, static) _clearAll()

Clear all checkboxes in the current display of grid rows

(private, static) _clearCurrentDisplay()

Clear the current data displayed in the table

(private, static) _createActionButtons()

Create the specified action buttons

(private, static) _createColumnHeaders()

Set the headers for the data grid, these are the field indentification labels which also have the ability to sort the data based on their content

(private, static) _createColumnSelectChecks()

Create the Checkboxes for the toggle column selection panel

(private, static) _createGridRow(item)

Create a new Grid Row

Parameters:
Name Type Description
item Object

The data array index item with the row data

(private, static) _createItemsPerPageSelect()

Create the items per page select menu

(private, static) _createPageSelectMenu()

Create the page select menu

(private, static) _createSearchInputs()

Create the search inputs for keyword and column selection

(private, static) _displayGridData()

Display the grid data in the table based on the current page and max per page items, however if external paging is done through the server the the gridData object will contain all the data available for the grid

(private, static) _getCellData(value, icon, link, text)

Get the Cell data, this could be in the form of an icon or external link

Parameters:
Name Type Description
value String

The cell value

icon String

The cell icon if any

link String

The external link if any

text String

Conversion of a db value to a given string

(private, static) _getHeaderArr()

Get the header column names as an array for the select menu in the search

(private, static) _getHeaderWidth()

Get the correct width of the header based on the width of the scrollbar if a browser standard scrollbar is used

(private, static) _getTotalPagesArr()

Get total page array for the select menu, this is an array of the total number of pages for the data loaded

(private, static) _handleHeaderSelection()

Handle the selection event for the search header

(private, static) _handleScroll()

Handle the horizontal scroll event

(private, static) _initialize()

Initialize the component and set the default properties

(private, static) _onAction()

Handles the action button click and delegates to the correct function callback

(private, static) _onColumnSelect()

Handles the column selection from the panel and will alter the displayed columns in the grid based on the selection

(private, static) _onDblClick()

Handle the cell double click

(private, static) _onHeaderToggle()

Handles the toggle sort order of the header columns, arrow down, will sort ascending, arrow up will sort descending only 1 column can be the filter for the sort at any time.

(private, static) _onLinkClick()

Handle a Cell link click, a cell that has a link to an external resource

(private, static) _onPageSelect()

Handle the page selection from the select menu, this will either force a recalculation of the displayed data or execute a callback and request data for the next page

(private, static) _onPerPageSelect()

Handle the perPage Selection to alter the number of items display

(private, static) _onRowSelect()

Handle the row click event

(private, static) _onSearch()

Handle the search action, this will either search through the loaded data or make a callback request to retrieve the search results from the server

(private, static) _onToggleHeadSelect()

Toggle the header select panel for the search

(private, static) _onTogglePageSelect()

Toggle the state of the select page panel

(private, static) _onTogglePerPageSelect()

Toggle the state of the max select per page panel

(private, static) _reload()

Reload Grid Data

(private, static) _removeEvents()

Set the events for the select menu

(private, static) _removeGridEvents()

Remove the events from click and change events from the data grid rows

(private, static) _removeListEvents()

Remove the events from the page list elements, which are dynamically adjusted

(private, static) _removeSelection(id)

Remove a selection, this is based on the usage of checkboxes in the grid columns

Parameters:
Name Type Description
id String

The id value of the row to remove, could be be a string or number representation

(private, static) _render()

Render the component element, this method can be called any number of times if the data for the component is added again

Search a specified column in the data for the specified key word

Parameters:
Name Type Description
key String

The search term

column String

The column name to search within

(private, static) _selectAll()

Select all checkboxes in the current display of grid rows, this does not select all data rows in the event the data is paged

(private, static) _setElements()

Returns an object with the default html elements added

(private, static) _setEvents()

Set the events for the select menu

(private, static) _setGridEvents()

Add the events to the grid items

(private, static) _setPageSelectOptions()

Set the page Select menu options

(private, static) _setPerPageSelectOptions()

Create the array of per page select options

(private, static) _setSelection()

Set the selected item in the selectedRowIds array object

(private, static) _setTotalPages(value)

For Data that is paged internally get the total page count based on the max per page

Parameters:
Name Type Description
value Number

The value to set for the total pages if it does not require calculation based on the current data

(private, static) _sort(column, asc)

Sort the data by a specific column specifying the directionof the sort

Parameters:
Name Type Description
column string

The column to sort the data by

asc boolean

Is the sort to be ascending or descending

(private, static) _sortData(property)

Sort the data array, ascending or descending by prefixing the property with a -

Parameters:
Name Type Description
property string

The property name to sort by

(private, static) _toggleColumnSelectPanel()

Toggle the column selection panel open and closed

(static) authorize()

Authorize an update in the grid i.e. on the double click event the user manually edited the field and then sent the request to the server to update the database row however the request could fail

(static) destroy()

Destroy the component and remove all elements from the dom and clear all events added, returns a null value in the event the object was stored in a reference to nullify the reference

(static) disable()

Disable the select menu item

(static) enable()

Enable the select menu item

(static) getSelected()

Return an array of selected data rows

(static) insert(data)

Insert a row into the data

Parameters:
Name Type Description
data array

The data to insert into the array

(static) remove(data)

Remove the selected items in the grid and data array

Parameters:
Name Type Description
data array

The array of data to remove

(static) resize()

Adds the no-pad selector to the header, fundamentally for HScroll since when over the boundary the header does not need to accommodate the width of the vscroll

(static) revert()

TODO Reverts a manual edit to a previous state if clicked out of the field, this would be used by a callback if the authorization for the change was not given

(static) setData(data)

Set the data for the grid, the is an array object which fields which must match the pattern defined in the header, note however that fields can be optionally hidden from the user.

Parameters:
Name Type Description
data array

The grid data

(static) update(data)

Update data in the array

Parameters:
Name Type Description
data array

The data update in the array

(static) updateCol(column, value)

Updates a specific column in all rows with a value

Parameters:
Name Type Description
column String

The column name to udpate

value *

The value to update for each column

(static) updateField(data)

Update data in the array

Parameters:
Name Type Description
data array

The data update in the array