Class CheckboxTable
The CheckboxTable object, a displayable table with a checkbox column and optional sorting (no paging)
Defined in: checkboxTable.js.
Constructor Attributes | Constructor Name and Description |
---|---|
CheckboxTable(tag)
|
Method Attributes | Method Name and Description |
---|---|
addHeader((anonymous))
Adds a header to the table.
|
|
addRow()
Adds a data row to the table.
|
|
Adds a data row to the table.
|
|
appendTo(parent)
Appends the table (and page block) to a parent node
|
|
Sets all the rows in the table to unchecked
|
|
getDataValue(row, col)
Get the contents of one table element for a specified row and column
|
|
getFontWeight(row)
Retrieves the font weight for one table row, as specified by its index.
|
|
This method returns the value of the next checked item, or null if there isn't one
|
|
getRow()
Returns the currently selected row
|
|
getRowColor(row)
Retrieves the background color for one table row, as specified by its index.
|
|
Returns the number of rows that have been added to the table
|
|
This method returns the number of checked rows
|
|
Get the index of the currently selected row.
|
|
Get the value of the checkbox of the currently selected row.
|
|
Make this table sortable - must be called after table has its contents
Although most of the code for this method is original, many of the design ideas were inspired
by examples at http://www.webtoolkit.info/, and much credit is due to the author(s) of that site.
|
|
Sets the index of the currently selected row to zero.
|
|
Sets all the rows in the table to checked
|
|
setBold(row)
Set the text style for one table row, as specified by its index, to bold.
|
|
setClass(clinfo)
Assigns a CSS class to the table - the default class is CheckboxTable
|
|
setRowColor(row, color)
Set the background color for one table row, as specified by its index.
|
Method Detail
addHeader((anonymous))
Adds a header to the table. Uses the anonymous arguments array as input, so no declared args.
- Parameters:
- {array of strings} (anonymous)
- The columns headers for the table
addRow()
Adds a data row to the table. Uses the anonymous arguments array as input, so no declared args.
myTable.addRow('ken','707-555-1212','ken@calast.com');
addRowWithValue()
Adds a data row to the table. Uses the anonymous arguments array as input, so no declared args.
The first argument is not displayable, but is assigned to the checkbox as a value.
myTable.addRowWithValue(42,'ken','707-555-1212','ken@calast.com');
appendTo(parent)
Appends the table (and page block) to a parent node
- Parameters:
- {DOM element} parent
- The DOM node to which this is added
deselectAll()
Sets all the rows in the table to unchecked
{mixed}
getDataValue(row, col)
Get the contents of one table element for a specified row and column
- Parameters:
- {number} row
- The row of interest, zero being the first tbody row
- {number} col
- The column of interest
- Returns:
- {mixed} The 'td' value at that row and column ('th' value for row 0) or null if not found
{string}
getFontWeight(row)
Retrieves the font weight for one table row, as specified by its index.
- Parameters:
- {number} row
- The row of interest, zero being the first tbody row
- Returns:
- {string} weight The font weight for that row, or null if it does not exist
{mixed}
getNextSelectedValue()
This method returns the value of the next checked item, or null if there isn't one
- Returns:
- {mixed} The value of the button in the next selected row
{number}
getRow()
Returns the currently selected row
- Returns:
- {number} The current row variable
{string}
getRowColor(row)
Retrieves the background color for one table row, as specified by its index.
- Parameters:
- {number} row
- The row of interest, zero being the first tbody row
- Returns:
- {string} color The background color for that row, or null if it does not exist
{number}
getRowCount()
Returns the number of rows that have been added to the table
- Returns:
- {number} The row count
{mixed}
getSelectedCount()
This method returns the number of checked rows
- Returns:
- {mixed} The count of checked rows
{number}
getSelectedRow()
Get the index of the currently selected row.
For checkbox tables, this function disallows multiple select. It returns null if zero or more
than one rows are selected.
- Returns:
- {number} The row index, or null if no row is selected.
{mixed}
getSelectedValue()
Get the value of the checkbox of the currently selected row. Requires use of addRowWithValue.
For checkbox tables, this function disallows multiple select. It returns null if zero or more
than one rows are selected.
- Returns:
- {mixed} The value of the checkbox, or null if the number of selected rows is not one.
makeSortable()
Make this table sortable - must be called after table has its contents
Although most of the code for this method is original, many of the design ideas were inspired
by examples at http://www.webtoolkit.info/, and much credit is due to the author(s) of that site.
resetIndex()
Sets the index of the currently selected row to zero.
selectAll()
Sets all the rows in the table to checked
setBold(row)
Set the text style for one table row, as specified by its index, to bold.
- Parameters:
- {number} row
- The row of interest, zero being the first tbody row
setClass(clinfo)
Assigns a CSS class to the table - the default class is CheckboxTable
- Parameters:
- {string} clinfo
- The CSS class to assign to the table's class attribute
setRowColor(row, color)
Set the background color for one table row, as specified by its index.
- Parameters:
- {number} row
- The row of interest, zero being the first tbody row
- {string} color
- The new background color for that row