Hi there,
I have noted the following behaviour, which seems to be erroneous on the part of Dhtmlx. Assume a tree with the following structure:
ID=1 My mail items
|
ID=2 (-)--Inbox
| |
ID=3 | |---Subfolder 1
| |
ID=4 | |---Subfolder 2
|
ID=5 |---Deleted items
Note that the Inbox folder with ID=2 is expanded and in front of it we see a - sign.
If I make the following call:
_dhtmlxTree.refreshItems(2, "generatexml.php?id=1");
My PHP document will create the following output:
<?xml version="1.0" encoding="UTF-8"?>
<tree id="1">
<item id="2" text="Inbox" im0="folder_new_16.png" im1="images/folder_new_16.png" im2="images/folder_new_16.png" child="1">
<userdata name="Class">4</userdata>
</item>
<item id="5" text="Deleted items" im0="images/folder_16.png" im1="images/folder_16.png" im2="images/folder_16.png" child="0">
<userdata name="Class">2</userdata>
</item>
</tree>
Which updates the tree to:
ID=1 My mail items
|
ID=2 (+)--Inbox
| |
ID=3 | |---Subfolder 1
| |
ID=4 | |---Subfolder 2
|
ID=5 |---Deleted items
Which seems to be erroneous because now the Inbox folder has a + sign in front of it, while it is in an expanded state.
I can get the desired result by omitting the child=“1” attribute in the xml document. The - sign (or the + sign if Inbox happens not to be expanded) is then left unchanged. However, this requires that my PHP code knows if the request is made for the purpose of loadXML() or the autoloader on one hand or refreshItems() on the other hand. Only the latter case should then omit the child=“1” attribute. I believe I can even make such distinction by examining the presence of the ids get parameter.
But…
- This would require extra logic on the php part, which means every developer will have to implement this without error. I would rather see this solved by Dhtmlx once.
- More importantly: I believe dhtmlXTree should never display a + sign on an item that is already expanded because it would make the interface inconsistent. Therefor, my preliminary conclusion is that this is a bug.
Dhtmlx, can you comment on this? Do you consider this bug too, will it be addressed and in which version? Also, is my current workaround through the ids parameter valid?
I am using dhtmlxSuite_v30_pro_111031.
Kind regards,
Joost
On a sidenote, I realize that at present my php xml generator produces more items than is necessary. The filter on the ids parameter is not yet implemented.