I used the weekend to create a new eTemplate widget, which shows a tree.
The Interface is quite similar to a selectbox. You supply the tree nodes
via the $sel_options parameter of etemplate::exec(). The difference is
only the id’s have to show the hierarchy path with a slash as delimiter, eg:
1 ± one
1/1 | ± one.one
1/2 | ± one.two
2 ± two
You can use a ‘1’ in the options attribute to specify a multiselection
with checkboxes. If you dont specify an onclick action (not onchange),
the result is returned via the content array. The onclick action can use
the variable:
- id (id/path of the clicked node),
- widgets name as variable containing the dhtmlxtree object (with
underscores instead of brackets, eg. tree_one instead of tree[one])
- document.getElementsByName(form::name(‘tree[one]’))[0] to access the
hidden var containing the selected node(s) id/path
The tree has a sub-widget called ‘tree-cat’ or Category tree to display
eGW categories. The 3. (comma-separated) option allows to specify an app
different from the current app. It converts the cat_id to a hierarchy
path internally and so expects and returns only cat_id’s, like the
’select-cat’ widget!
As an example there’s now an other configuration in addressbook, to
display a category tree in the extra category tab, instead of the
checkbox multiselection.
ToDo: Allow to specify a callback to dynamicly load the nodes on request
(user opens the parent node).
I might commit it to 1.4 too, so it can be used in (extra) apps written
for 1.4 …
Ralf
Ralf Becker
eGroupWare Training & Support ==> http://www.egroupware-support.de
Outdoor Unlimited Training GmbH [www.outdoor-training.de]
Handelsregister HRB Kaiserslautern 3587
Geschäftsführer Birgit und Ralf Becker
Leibnizstr. 17, 67663 Kaiserslautern, Germany
Telefon +49 (0)631 31657-0
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
eGroupWare-developers mailing list
eGroupWare-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-developers