Class SelectorTable
The SelectorTable object, a displayable table with a radio button column and optional paging.
Defined in: selectorTable.js.
Constructor Attributes | Constructor Name and Description |
---|---|
SelectorTable(tag)
|
Method Attributes | Method Name and Description |
---|---|
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
|
|
enablePaging(listener)
Turn paging on for this object
|
|
getDataValue(row, col)
Get the contents of one data element for a specified row and column
|
|
getHeaderValue(row, col)
Get the contents of one header element for a specified row and column
|
|
Returns the number of rows that have been added to the table
|
|
getRowValue(row)
Get the value of the button of the specified row.
|
|
Get the index of the currently selected row, zero being first tbody row
|
|
getSelectedColumn(col)
Get the contents of one table element from the currently selected row
|
|
Get the value of the button of the currently selected row.
|
|
nextPage()
Display the next page of the table; called from event listener.
|
|
onClick(listener)
Add an (optional) event listener to every radio button - must be called AFTER rows have been added.
|
|
prevPage()
Display the previous page of the table; called from event listener.
|
|
Does the actual display; called from showPage, nextPage, or prevPage
|
|
setClass(clinfo)
Assigns a CSS class to the table
|
|
setColors(normal, selected)
Set the background colors for the table object
|
|
setPageSize(sz)
Set the number of table rows per page
|
|
setTextColor(row, col, selected)
Set the text color for one table element
|
|
showPage(pagenum)
Display a specific page of the table; called from event listener.
|
|
updateRowWithValue((anonymous))
Finds a row by button value, changes other columns.
|
Method Detail
addHeader()
Adds a header to the table. Uses the anonymous argument array as input, so no declared args.
addRow()
Adds a data row to the table. Uses the anonymous argument 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 argument array as input, so no declared args.
The first argument is not displayable, but is assigned to the radio button 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
enablePaging(listener)
Turn paging on for this object
- Parameters:
- {function} listener
- An event listener to be called when user clicks on prev and next buttons
{mixed}
getDataValue(row, col)
Get the contents of one data element for a specified row and column
- Parameters:
- {number} row
- The row of interest, zero being first tbody row
- {number} col
- The column of interest
- Returns:
- {mixed} The 'td' value at that row and column or null if not found
{mixed}
getHeaderValue(row, col)
Get the contents of one header element for a specified row and column
- Parameters:
- {number} row
- The row of interest, zero being first thead row (usually only one)
- {number} col
- The column of interest
- Returns:
- {mixed} The 'th' value at that row and column or null if not found
{number}
getRowCount()
Returns the number of rows that have been added to the table
- Returns:
- {number} The row count
{mixed}
getRowValue(row)
Get the value of the button of the specified row. Requires use of addRowWithValue.
- Parameters:
- {number} row
- The data row of interest.
- Returns:
- {mixed} The value of the selector button, or null if no row is selected.
{number}
getSelected()
Get the index of the currently selected row, zero being first tbody row
- Returns:
- {number} The row index, or null if no row is selected.
{array}
getSelectedColumn(col)
Get the contents of one table element from the currently selected row
- Parameters:
- {number} col
- The column of interest
- Returns:
- {array} The 'td' value at that row and column, null if none selected
{mixed}
getSelectedValue()
Get the value of the button of the currently selected row. Requires use of addRowWithValue.
- Returns:
- {mixed} The value of the selector button, or null if no row is selected.
nextPage()
Display the next page of the table; called from event listener.
onClick(listener)
Add an (optional) event listener to every radio button - must be called AFTER rows have been added.
- Parameters:
- {function} listener
- The function to be called when the user clicks on a radio button
prevPage()
Display the previous page of the table; called from event listener.
refreshPage()
Does the actual display; called from showPage, nextPage, or prevPage
setClass(clinfo)
Assigns a CSS class to the table
- Parameters:
- {string} clinfo
- The CSS class to assign to the table's class attribute
setColors(normal, selected)
Set the background colors for the table object
- Parameters:
- {mixed} normal
- The color to use for the non-selected rows
- {mixed} selected
- The color to use for the selected row
setPageSize(sz)
Set the number of table rows per page
- Parameters:
- {number} sz
- The number of rows per page
setTextColor(row, col, selected)
Set the text color for one table element
- Parameters:
- {number} row
- The row of interest, zero is first tbody row
- {number} col
- The column of interest
- {mixed} selected
- The color to use for the selected element
- Returns:
- true if the row and column were found, false otherwise
showPage(pagenum)
Display a specific page of the table; called from event listener.
- Parameters:
- {number} pagenum
- Which page to display
updateRowWithValue((anonymous))
Finds a row by button value, changes other columns. Uses the anonymous argument array as input,
so no declared args.
myTable.updateRowWithValue(42,'bob','707-555-1213','keng@calast.com');
- Parameters:
- {array of String} (anonymous)
- First element is value to find, rest are replacement values