Tree node refresh fails

Hi,

i have the pro version (v25_pro_91111).

I am loading a tree with via xml. The first two level’s direct, the rest on demand.
If refresh two nodes of the second level, the second gets the node text from the first one.

Method: tree.refreshItem(itemId).

Regards, Stefan

Hello,

Please check refreshItem loads the xml that is returned by the script defined in the setXMLAutoLoading method. Therefore, check that the script returns desired xml.

If you want to define some other script, you may try to use smartRefreshItem method:

tree.smartRefreshItem(itemId,script);

Alexandra,

thsi is quite clear. But can you advise me some sample. There i nothing in the examples library and the api description is quite unclear, how the xml output should be look like.
I am loading a tree via xml. the fist load looks like:

<?xml version="1.0" encoding="utf-8" ?>

Now if the user expands the node o~FR the server returns:

<?xml version="1.0" encoding="utf-8" ?>

In the case of refreshing items, this works for 1 item.
If i am useing the method …RefreshItems( … ) , the server gets a parameter ids with a comma-separated list.
For example ids=o~FR,o~ZF.

What output is expected?

  • <tree id=“o~FR” open=“0” <?xml version="1.0" encoding="utf-8" ?>

fails :frowning:?

i can only refresh two nodes independant with yout method if if make a litte pause between the two operations. Also the subsequant method calls causes an error.

Best regards, Stefan

Stefan,

there can be only one tag in the xml. If you use refreshItems method, the tree will update only the nodes those are defined in the first parameter of this method:

tree.refreshItems(“o~FR,o~ZF”,script);

the script can return xml with 2 tags:

<?xml version="1.0" encoding="utf-8" ?>

The child items aren’t updated in this case (as you didn’t define them in the refreshItems method).

if you want to update the child items of both “o~FR” and “o~ZF”, you should call refreshItem or smartRefreshItem twice:

tree.smartRefreshItem(“o~FR”);
tree.smartRefreshItem(“o~ZF”);

If i do

     tree.smartRefreshItem("o~FR");
     tree.smartRefreshItem("o~ZF");

the child nodes will be doubled :frowning:

When i enable smart rendering, the childs get doubled and the imgages of the tree lines for
some nodes will be not displayed.

My tree configurations is:

    <script  src="../../libraries/dhtmlx/dhtmlxTree/codebase/dhtmlxcommon.js"></script>
    <script  src="../../libraries/dhtmlx/dhtmlxTree/codebase/dhtmlxtree.js"></script>
    <script  src="../../libraries/dhtmlx/dhtmlxTree/codebase/ext/dhtmlxtree_xw.js"></script>
    <script  src="../../libraries/dhtmlx/dhtmlxTree/codebase/ext/dhtmlxtree_srnd.js"></script>
    <script  src="../../libraries/dhtmlx/combobox/dhtmlxcombo.js"></script>


              tree = new dhtmlXTreeObject("treeboxbox_tree","80%","80%",0);
              tree.setImagePath("../../libraries/dhtmlx/tree/codebase/imgs/");
              tree.setIconSize(0,0);
              tree.enableSmartXMLParsing(true);
              tree.enableSmartRendering(true);
              tree.setXMLAutoLoading("objects.xml?uname=<%=sy-uname%>");
              tree.setOnLoadingStart(func_a);
              tree.setOnLoadingEnd(func_b);
              tree.enableTreeLines("true");
              tree.setIconSize(0,0);
              tree.loadXML("objects.xml?uname=<%=sy-uname%>");

Best regards,
Stefan

Hi,

if i use

      tree.refreshItem("o~FR");
      tree.refreshItem("o~ZF");

the tree doubles not the child itemes, but changes the text of the nodes (see attached pic tree_wosmart.PNG)

Regards, Stefan


Hi,

you may try to use the following to solve the issue:

var h = tree.attachEvent("onXLE",function(){ tree.detachEvent(h); tree.smartRefreshItem("o~ZF"); }) tree.smartRefreshItem("o~FR");

or

var h = tree.attachEvent("onXLE",function(){ tree.detachEvent(h); tree.refreshItem("o~ZF"); }) tree.refreshItem("o~FR");

When i enable smart rendering, the childs get doubled and the imgages of the tree lines for
some nodes will be not displayed.

Smart Rendering isn’t compatible with dynamic loading. Smart Parsing can be used, but there is no need in it if nodes are dynamically loaded.