Hi,
I'm playing with YUI TreeView and the Tree component. The Tree is saved in a
database with the data fields in the same table as the tree itself:
id, parent_id, name, some_more_data
Nodes are added via AJAX to the YUI tree everytime a node is opened.
In the moment this results in two database queries for each AJAX request:
1. Get the IDs of the nodes
2. Get the Data for all the IDs.
I'd like to enhance the component with an
ezcTreeDbInternalTableDataStore class which can be used for my setup.
The fetchChildren method of each db backend could then be enhanced with an
additional parameter to specify, which data fields should be prefetched.
Is this a good idea?
Along with this feature request comes the next one: It would be fine, if the
fetchChildren method could also include the SQL to ask in one query, whether
a node has children. This information can then be used to use different icons
in the YUI tree.
Something like this may work:
'SELECT id, parent_id'
.implode(',', $data_fields).
', subnr'.
'FROM indexTable as i,
(select count(*) from indexTable where parent_id = id) as subnr
WHERE parent_id = $nodeId'
Have a nice weekend,
--
Thomas Koch, Software Developer
http://www.koch.ro
Young Media Concepts GmbH
Sonnenstr. 4
CH-8280 Kreuzlingen
Switzerland
Tel +41 (0)71 / 508 24 86
Fax +41 (0)71 / 560 53 89
Mobile +49 (0)170 / 753 89 16
Web www.ymc.ch
--
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components