The edit_table draws a table that is editable. The storage of the edited date is not done by the table itself. You as developer using the table, have to store the data yourself in a database or wherever you like store the data. the editable table provides methods to read the changed data.
The edit_table is a subclass of datatable.
instantiates the edit_table
Passes the data to show to the table. The table redraws itself after this call. principally works like drawTable in the datatable, unsaved changes will be lost.
Sets a special editor for the cell-values of a specified column. An editor must be a subclass of input (in modules/tools/input.js). The table uses the methods setValue and getValue of the given editors and the on app defined methods “setContainer”. If no editor is set for a particular column a “normal” text-input is used as editor component.
To achieve that a column will get “read-only” set its editor to null
Examples:
table.setEditor('id', null); // makes the id-column read-only
table.setEditor('income', new number_input(null)); // Sets the income-editor to "numbers-only" textinput
table.setEditor('birthday', new dateinput(null)); // Sets the editor to a dateinput, a module to enter dates
var divisions = {'R&D':'Development', 'prod':'Production', 'sales':'Sales', 'purchase':'Purchasing'};
table.setEditor('department', new selector(null, divisions )); // to use a selector for division.
Revokes the users changes.
Adds a new row at the end of the table an sets the courser into it.
returns whether anything has been edited or not
Returns a hashtable of all edited rows. As key, the value of the defined idCol is user (see setIdCol at datatable)
@param idAsKey boolean - OPTIONAL - If this argument is set to true, the method returns a numeric array of the edited rows.
If the idCol is not set a numeric array will be returned. The records itself are hashtables, key: columnname, value: the value
returns a numeric array of the newly created rows. The records itself are hashtables, key: columnname, value: the value
Returns a numeric array of all edited rows and all inserted rows.
A shortcut for:
var updated = table.getUpdatedRows(false); // als numeric Array var inserted = table.getInsertedRows();