|
PHP2Go Javascript Framework | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object
|
+--Widget
|
+--DataTable
Defined in widgets/datatable.js
| Field Summary | |
Object |
anchor
Current anchor row |
Boolean |
desc
Current order direction (true=descending, false=ascending) |
Object |
root
Reference to the widget's root node |
Array |
selected
Current selected rows |
Number |
sortIdx
Current sort column index |
Object |
sortTypes
Sort types |
Object |
table
Reference to the modified table |
Object |
tbody
Reference to the table body |
Object |
thead
Reference to the table head |
<static> Object |
instances
Holds existent DataTable instances, indexed by widget ID. |
| Fields inherited from class Widget |
attributes
|
| Constructor Summary | |
DataTable
(<Object> attrs, <Function> func)
DataTable is a used that transforms a regular HTML table by adding dynamic behaviors, such as sorting, row highlighting and single/multiple row selection |
|
| Method Summary | |
<private> Number
|
_compare(<Object> a, <Object> b)
Default method to compare 2 cell values. |
<private> String
|
_getRowValue(<Object> row, <Number> idx)
Default method to read the text contents of a table cell |
<private> void
|
_onResize()
Table resize handler |
<private> void
|
_setupRows()
Configures CSS classes for all table rows |
<private> void
|
_setupScroll()
Adds scrollable behavior on the data table |
void
|
addSortType(<String> type, <Function> valueFunc, <Function> compareFunc, <Function> rowFunc)
Register a new sort type |
Object
|
getFirstRow()
Get table's first row |
Object
|
getNextRow(<Object> row)
Get the previous sibling of a given row |
Object
|
getPreviousRow(<Object> row)
Get the next sibling of a given row |
Array
|
getSelectedRows()
Get current selected rows |
void
|
reset()
Refreshes sorting and scrolling behaviors. |
<private> void
|
selectHandler(<Event> e)
Handles click event on table rows |
void
|
selectRow(<Number> idx, <Boolean> b, r)
Selects or unselects a given table row |
<private> void
|
selectRowUI(<Object> row, <Boolean> b)
Applies selection UI changes on a given row |
void
|
setup()
Initializes the widget |
void
|
sort(<Number> idx, <Boolean> desc)
Sorts the table by a given column index |
<private> void
|
sortHandler(<Event> e)
Handles click event on table headers |
| Methods inherited from class Widget |
hasAttributes
|
| Field Detail |
Object anchor
Boolean desc
Object root
Array selected
Number sortIdx
Object sortTypes
Object table
Object tbody
Object thead
<static> Object instances
| Constructor Detail |
DataTable(<Object> attrs, <Function> func)
attrs - Widget's attributes
func - Setup function
| Method Detail |
<private> Number _compare(<Object> a, <Object> b)
a - Left operand
b - Right operand
<private> String _getRowValue(<Object> row, <Number> idx)
row - Table row
idx - Column index
<private> void _onResize()
<private> void _setupRows()
<private> void _setupScroll()
void addSortType(<String> type, <Function> valueFunc, <Function> compareFunc, <Function> rowFunc)
type - Type name (prefer using uppercase)
valueFunc - Function to traduce cell contents into a comparable value
compareFunc - Function to compare column values
rowFunc - Function to extract contents from a row's cell
Object getFirstRow()
Object getNextRow(<Object> row)
row - Table row
Object getPreviousRow(<Object> row)
row - Table row
Array getSelectedRows()
void reset()
<private> void selectHandler(<Event> e)
e - Event
void selectRow(<Number> idx, <Boolean> b, r)
idx - Row index
b - Select/unselect
r - Whether 'changeselection' event must be triggered
<private> void selectRowUI(<Object> row, <Boolean> b)
row - Table row
b - Select/unselect
void setup()
void sort(<Number> idx, <Boolean> desc)
idx - Column index, zero based
desc - Descending?
<private> void sortHandler(<Event> e)
e - Event
|
PHP2Go Javascript Framework | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||