Documentation
EditTable Class
General Public Methods
Method | Description | Remarks | Example |
---|---|---|---|
Init() | EditTable object initialisation | var myET = new EditTable('myTableId'); |
|
GetCellsNb( rowIndex ) | returns number of cells of a specified row | myET.GetCellsNb(4); |
|
GetRowsNb() | returns total number of rows | myET.GetRowsNb(); |
|
GetRow(e) | returns the DOM row element for a given event | function myFunction(e){ var clickedRow = myET.GetRow(e); } |
|
GetRowByIndex( rowIndex ) | returns the DOM row element for a given row index | myET.GetRowByIndex(5); |
|
GetCell(e) | returns the DOM cell element for a given event | function myFunction(e){ var clickedCell = myET.GetCell(e);
} |
|
IsSelectable() | checks if table rows are selectable and returns a boolean | myET.IsSelectable(); |
|
IsEditable() | checks if table is editable and returns a boolean | myET.IsEditable(); |
|
ClearSelections() | clears current row(s) and/or cell selection | myET.ClearSelections(); |
Selection Public Methods
Method | Description | Remarks | Example |
---|---|---|---|
Init() | Selection object initialisation | var myET = new EditTable('myTableId'); |
|
Set() | enables selection feature | myET.Selection.Set(); |
|
Remove() | disables selection feature | myET.Selection.Remove(); |
|
SetEvents() | sets click and keyboard events to table element | myET.Selection.SetEvents(); |
|
RemoveEvents() | removes click and keyboard events to table element | myET.Selection.RemoveEvents(); |
|
GetActiveRow() | returns the active row element, that is, the row currently selected | var activeRow = myET.Selection.GetActiveRow(); |
|
GetActiveCell() | returns the active cell element, that is, the cell currently selected | var activeCell = myET.Selection.GetActiveCell(); |
|
GetSelectedRows() | returns an array of the row elements currently selected, if selection model is multiple | returns: [rowobject, rowobject, rowobject, ... rowobject] |
var selRows = myET.Selection.GetSelectedRows(); |
GetSelectedValues() | returns an array containing a collection of selected rows values | returns: [ ['value 0', 'value 1', 'value 2', ... 'value 3'], ['value 0', 'value 1', 'value 2', ... 'value 3'], ['value 0', 'value 1', 'value 2', ... 'value 3'], ... ['value 0', 'value 1', 'value 2', ... 'value 3'] ] |
var selValues = myET.Selection.GetSelectedValues(); |
GetActiveRowValues() | returns an array containing the cell values of active row | returns ['value 0', 'value 1', 'value 2', ... 'value 3'] | var activeValues = myET.Selection.GetActiveRowValues(); |
GetRowValues( row ) | returns an array containing the cell values of a given row, it accepts only a row DOM element | returns ['value 0', 'value 1', 'value 2', ... 'value 3'] |
|
SelectRowByIndex( rowIndex ) | selects a row for a given row index | myET.Selection.SelectRowByIndex(9); |
|
SelectRowsByIndexes( rowIndexes ) new | selects rows for a given array of row indexes | Multiple selection needs to be active (selection_model: 'multiple') | myET.Selection.SelectRowsByIndexes([2, 7, 9, 12]); |
SelectRow( row ) | selects given row element | var myRow = myET.GetRowByIndex(6); |
|
DeselectRow( row ) | deselects given row element | var myRow = myET.GetRowByIndex(6); |
|
SelectCell( cell ) | selects given cell element | var myCell = myET.GetRowByIndex(3).cells[2]; |
|
DeselectCell( cell ) | deselects given cell element | var myCell = myET.GetRowByIndex(3).cells[2]; |
|
ClearSelections() | clears current row(s) and/or cell selection | The general ClearSelections() invokes this method (
myET .ClearSelections () ) |
myET.Selection.ClearSelections(); |
IsRowSelected( row ) | determines if given row is selected and returns a boolean | var myRow = myET.GetRowByIndex(6); |
|
IsCellSelected( cell ) | determines if given cell is selected and returns a boolean | var myCell = myET.GetRowByIndex(3).cells[2]; |
Editable Public Methods
Method | Description | Remarks | Example |
---|---|---|---|
Init() | Editable object initialisation | var myET = new EditTable('myTableId'); |
|
Set() | enables inline editing feature | myET.Editable.Set(); |
|
Remove() | disables inline editing feature | myET.Editable.Remove(); |
|
SetEvents() | sets click and keyboard events to table element | myET.Editable.SetEvents(); |
|
RemoveEvents() | removes click and keyboard events to table element | myET.Editable.RemoveEvents(); |
|
GetModifiedRows() | returns an array containing the modified rows objects | returns: [ [rowIndex, { values: [val0, val1, ...valn], urlParams: '&ColName0=cellvalue0&ColName1=cellvalue1', modified: [true, false, ...] }], ... [rowIndex, { values: [val0, val1, ...valn], urlParams: '&ColName0=cellvalue0&ColName1=cellvalue1', modified: [true, false, ...] }] ] urlParams are the paramaters names that are expected server-side. If the parameters' names are not defined by the property param_names
in the actions object (configuration object actions),
the param name by default equals to 'col_n' where
n is the column index (col_0, col_1, ... col_n) |
|
GetAddedRows() | returns an array containing the added rows objects | returns: [ [rowIndex, { values: [val0, val1, ...valn], urlParams: '&ColName0=cellvalue0&ColName1=cellvalue1', modified: [true, true, ...] }], ... [rowIndex, { values: [val0, val1, ...valn], urlParams: '&ColName0=cellvalue0&ColName1=cellvalue1', modified: [true, true, ...] }] ] urlParams are the paramaters names that are expected server-side. If the parameters' names are not defined by the property param_names
in the actions object (configuration object actions),
the param name by default equals to 'col_n' where
n is the column index (col_0, col_1, ... col_n) |
var addRowObjs = myET.Editable.GetAddedRows(); |
GetDeletedRows() | returns an array containing the deleted rows objects | returns: [ [rowIndex, { values: [val0, val1, ...valn], urlParams: '&ColName0=cellvalue0&ColName1=cellvalue1', modified: [false, false, ...] }], ... [rowIndex, { values: [val0, val1, ...valn], urlParams: '&ColName0=cellvalue0&ColName1=cellvalue1', modified: [false, false, ...] }] ] urlParams are the paramaters names that are expected server-side. If the parameters' names are not defined by the property param_names
in the actions object (configuration object actions),
the param name by default equals to 'col_n' where
n is the column index (col_0, col_1, ... col_n) |
var delRowObjs = myET.Editable.GetDeletedRows(); |
SubmitEditedRows() | submits edited rows to server according to actions configuration options | modified rows objects are sent to server (uri property in 'update' actions configuration options) |
|
SubmitAddedRows() | submits added rows to server according to actions configuration options | added rows objects are sent to server (uri property in 'insert' actions configuration options) | function SaveAddedRows(){
myET.Editable.SubmitAddeddRows();
} |
SubmitDeletedRows() | submits deleted rows to server according to actions configuration options | deleted rows objects are sent to server (uri property in 'delete' actions configuration options). A confirmation prompt appears before sending data to server |
|
SubmitAll() new | submits added and edited rows to server according to actions configuration options | function SubmitAll(){ myET.Editable.SubmitAll(); } |
|
AddNewRow() | adds a row to the table | myET.Editable.AddNewRow(); |