Hi,
I have continued work on my Dynamic Table widget, which is now a widget on
its own and does not require any support in the ui code to work. Please let
me know your comments and suggestions.
Description of the widget: the Dynamic Table widget allows for rows to be
added to a table using javascript (no ajax involved). The widget will use
the second row of the table as a template for additional rows to be added
(it assumes the first one is for the title). Upon submitting the form, the
added widgets will be checked against the same conditions as the 2nd row of
the table
The script creates an object of the type DynamicTable. This object
implements two functions: addRow and removeRow, which are to be called by
the user to add and remove rows to the table. When using DynamicTable, the
developper must organise the calling of these functions as he/she fit.
Support for extending the class DynamicTable is provided, with two callback
functions being defined and called by addRow and removeRow: onRowAdd and
onRowDelete
Options of the widget (comma separated list):
- name of template to used for the rows
- name of the table object created by the script, by default tbl
- name of the class to use for the dynamic table, by default this is
DynamicTable; however this can be changed to use a derived class for
instance
The code can be found here:
Widget code:
http://blueerp.svn.sourceforge.net/viewvc/blueerp/trunk/entity/inc/class.entity_DynamicTable_widget.inc.php?view=markup
Supporting javascript:
http://blueerp.svn.sourceforge.net/viewvc/blueerp/trunk/entity/js/DynamicTable.js?view=markup
Exemple of use:
Go to the blue erp demo (http://dev.mitija.com/blueerp)
- simple dynamic table: check Contact->Customer->Add Customer the 'extras’
tab
- complex dynamic table with calculation on the rows: check AR->Quote->Add
for an example of the use of a class which extends the base DynamicTable
class to perform calculation (here, summing the rows)
–
Raphael Alla
Mitija Australia
+61 4 15 678 576
+687 78 86 86
http://www.mitija.com