dhtmlxTree issue

we are using dhtmlxTree 2.0 pro version…



The hard coaded xml for tree we are using is

--------------------------------------------------------------------------------



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

    

        

            

            

                userentityid

                Domain_list_tree_view.xsl

                entity^^domain^^metaproperty^^entityid

                true

            

            

        

    



--------------------------------------------------------------

Problem is every thing works fine if we double click on the node(Enterprise)… but for the first time after loading xml, if we click on + sign of Enterprise the following two error prompts…

i. Error type : Load XML

Description : Incorrect XML



ii. Error Type : DataStructure

Description : XML refers to not existing parent.



Again if I click on + sign Error doesn’t come and Enterprise expands…



Then, why first time errror has coming…



After expanding Enterprise node, For Domains subnode, I am using the setXMLAutoLoading function to load the tree dynamically…

here also its work fine if i double click on Domain node. But if I click on + sign on Domains for the first time same above mentioned two errors comes and after click again to the + sign on Domains it does respond like what the Enterprise was behaveing… After then I have to forcefully refresh the application…



If I simply double click on the nodes then every things work fine… tree grows dynamically and after that + sign and - sign functionality works…



Plz help and guide me since it is blocker issue for me



thanx

sandip


Please, check that the xml for “Enterprise” node is correct.


If the issue still occurs, please provide the tree initialzation code. And xml which causes the issue (which is loaded when you open Enterprise node).


This information will allow us find the reason for the problem.

the initialization code i am using is
//Create entityView object
entityViewObj = new entityView(MainFlowAccord, “entityview”);
entityViewObj.init();
------------

function entityView(MainFlowAccord, AccordCellTreeId)
{
    this.entityViewTree = MainFlowAccord.cells(AccordCellTreeId).attachTree();
    this.initiator = “entityview”
    this.IsUpdateViewCalledFirstime = “false” ;
    this.IsIAmOpen = false;
}

entityView.prototype.init = function()
{   
    this.entityViewTree.setImagePath(‘dhtmlxTree/codebase/imgs/’);
   
    this.entityViewTree.enableSmartRendering(“true”);
    this.entityViewTree.enableKeyboardNavigation(true);
    this.entityViewTree.attachEvent(“onClick”, this.onSingleClick );
   
    if ( this.IsUpdateViewCalledFirstime == “false” )
    {
        this.entityViewTree.loadXMLString(document.getElementById(‘entitytree’).value);
        this.IsUpdateViewCalledFirstime = “true”;
    }
    this.entityViewTree.attachEvent(“onXLE”, this.callAfterGridLoad);
}
-------------------------------------------------------

and on my event controller i am updating the entityview by calling the function updateView()
entityView.prototype.updateView = function(initiator, eventname)
{
    var isSelfInit = this.isSelfInitiator(initiator);
    if(isSelfInit)
    {
        var entity= this.entityViewTree.getSelectedItemId();
        var metaProperty = this.entityViewTree.getParentId(entity);
        var szLocation =  location.protocol + “//” +location.host;
        this.entityViewTree.setXMLAutoLoading(szLocation+"/EntityView.jsp?entity="+this.entityViewTree.getUserData(entity,“entity”)+"&metaproperty="+this.entityViewTree.getUserData(entity,“metaproperty”)+"&parentid="+entity+"&xslfile="+this.entityViewTree.getUserData(entity,“treeviewxslfile”)+"&search="+this.entityViewTree.getUserData(metaProperty,“search”));
        return true;
    }
    if(initiator == “applicationview”)
    {
        ;
        //alert(“Initiator is " + initiator + " no need to update the entity view.”);
    }
}



Smart Rendering is not compatible with dynamic loading. So the following line should be deleted:


//this.entityViewTree.enableSmartRendering(“true”);


If there are a lot of nodes per level, you can use distributed parsing in addition to dynamic loading.


Actually there is not any difference either you open node by + or double clicking. But in case of double clicking onClick event is also called (in your code onSingleClick method). Possibly there is the reason for the issue.


Also please check that the xml is correct (as you haven’t provided it).

hi,

this question is in contineous to the last queries
As I already told that some part of the tree is loaded statically, and some remaining part are loading dynamically…

The static part:


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

    

        

            

            

                userentityid

                Domain_list_tree_view.xsl

                entity^^domain^^metaproperty^^entityid

                true

            

            

        

    



The dynamic part is loaded by using the command,
     this.entityViewTree.setXMLAutoLoading(szLocation+"/EntityView.jsp?entity="+this.entityViewTree.getUserData(entity,“entity”)+"&metaproperty="+this.entityViewTree.getUserData(entity,“metaproperty”)+"&parentid="+entity+"&xslfile="+this.entityViewTree.getUserData(entity,“treeviewxslfile”)+"&search="+this.entityViewTree.getUserData(metaProperty,“search”));

The output of the above command is
 

    domain^^test.int
    entity^^domain^^domain^^test.int
    GridTramsformation.xsl
   
   
        user
        entityid
        User_list_tree_view.xsl
        entity^^user^^metaproperty^^entityid^^domain^^test.int
        true
   
   
        group
        entityid
        Group_list_tree_view.xsl
        entity^^group^^metaproperty^^entityid^^domain^^test.int
        true
   
   
        usercos
        entityid
        UserCOS_list_tree_view.xsl
        entity^^usercos^^metaproperty^^entityid^^domain^^test.int
        true
   




The above result(tree) generated only if we double click on the Domains node having id=“Domains” of the static part. The above tree will attach to the static tree having the node id “Domains”.

Till here everything is fine. but after rendering the tree if the we click on the test.int node the the childs Groups, UserCOS n Users child is showing the + sign in front of them(logically, It must not be showing… Since no futher chield part are present ).

Why it is showing so… I want to get ride of from + sign if not child are present… what should I do???

Interesting part it if I marge the above tree(dynamic tree) with the static part correctly n replace it in tree.xml of ur samples folder… and run it then it is not showing the + sign in front of leaf node (Users, Groups & UserCOS)…


Plz help where is the bug…
thanx
sandip





Hello,


You’ve written "logically, It must not be showing… Since no futher chield part are present ".


Actually tree doesn’t know if child items are presented for a ceratain node in the database. It is a client-side component and it reads the information about nodes from the loaded xml.


You have set child=“1” for “Groups” and other items. It means that the child items will be loaded dynamically - that is why + is shown.


So, please, don’t set child=“1” for items without children.

yes… but the problem is that if I set child=“0”, then its true that + sign is not showing… but in this case when I need to load  data dymanically e.g.  for  Groups then the dynimically loading of the child to the Groups node is not happening.

So how can I restrict, so that Groups can not show +sign( Since its a clint side functionality), but after double click on the ‘Groups’ node the data should render as a child to ‘Groups node’ …


Plz help
thanks


Ok… child=“1” attribute means that item has child item that are loaded dynamically, child=“0” or without child - a simple tree node.


So, when you generate the xml, you should define here which items will be loaded dynamicaly and set child=“1” for them.


For example “Groups” item tag should contain child=“1”, some other nodes don’t.

That means there is bug in Tree component… I am saying so because it is logically incorrect that If the parent node(in XML) can contains child=“1”, then only it can append the child nodes dynamically. But If there is no children assigned initially and click on + sign then it will give the incorrect XML loading error…

The solutions should be like that, if XML contains no child, then irrespective of child=“0” or child=“1”, It should not show + sign(currently was showing)… During the dynamically loading of child XML (using function setXMLAutoLoading(filePath) ), It should append the children and then need to show + sign against the parent node…

To acheive the solution of above questions I want to ask you a question…
Can I declaire child=“0” initially(so that + sign should not show) and then before loading child xml dynamically, I should able to change the behaviour of Parent as child=“1” n then load… I guess there is a function for that showItemSign(…)
[
Professional] . Is I am guessing correct if yes that what I the syntax of the function since no example is been provided… We are using dhtmlTree 2.0 professional version…


plz guide
sandip

t is logically incorrect that If the parent node(in XML) can contains child=“1”, then only it can append the child nodes dynamically
The nodes can be added dynamically ( by the script for example ) to any node in tree. “child” attribute used in case of dynamical loading, to mark which items will execute dyn. loading from server on opening.

Tree show + icon in next cases
- xml contains sub-items
- xml doesn’t contain sub-items, but has child=“1” - dyn. loading situation

>>During the dynamically loading of child XML
And how in such scenario, client side component will known , for which item it need to load data from server and for which not?
More than that, in such scenario - no item will have plus sign in tree, it will be pretty cryptic for a user, in common tree - node which can be expanded always has some plus-like sign.

>>Can I declaire child=“0” initially(so that + sign should not show) and then before loading child xml dynamically
You can use child = 0 and use onDblClick event as

tree.attachEvent(“onDblClick”,function(id){
tree._loadDynXML(id);
return true;
})

It will exec dyn. loading from server for any node in tree. usage of showItemSign is not necessary in such scenario.
Beware, that it is not standard mode of tree - so it may have some side-effects

above solution doesn’t work… can u plz provide me the sample of function showItemSign(…)

thanx
sandip


The sample is dhtmlxTree/samples/appearance/pro_item_signs.html ( dhtmlx.com/docs/products/dhtmlxT … signs.html ).


But this method hides/shows + (or -) icon only for folders - items with child items.