Problem with selecting item from xml

Hi all,

i have a problem with pre-selecting item after load data from xml. I have following xml:

<?xml version="1.0" encoding="UTF-8"?>
<tree id="0">
	<item id="type0" select="1">
		<userdata name="url"><![CDATA[../monitor/monitor.html?type=all]]></userdata>
		<itemtext><![CDATA[<span class='treeItemInner'><span class='treeItemLeft'>All events</span></span>]]></itemtext>
	</item>  
	<item id="type1">
		<userdata name="url"><![CDATA[../monitor/monitor.html?type='EVENTS';'FEEDREQ']]></userdata>
		<itemtext><![CDATA[<span class='treeItemInner'><span class='treeItemLeft'>Data feed requests</span></span>]]></itemtext>
	</item>    
	<item id="type2">
		<userdata name="url"><![CDATA[../monitor/monitor.html?type='EVENTS';'DATAFEED']]></userdata>
		<itemtext><![CDATA[<span class='treeItemInner'><span class='treeItemLeft'>Data feeds</span></span>]]></itemtext>
	</item>    
	<item id="type3">
		<userdata name="url"><![CDATA[../monitor/monitor.html?type='EVENTS';'CONREQ']]></userdata>
		<itemtext><![CDATA[<span class='treeItemInner'><span class='treeItemLeft'>Consumer requests</span></span>]]></itemtext>
	</item>    
	<item id="type4">
		<userdata name="url"><![CDATA[../monitor/monitor.html?type='EVENTS';'DIST']]></userdata>
		<itemtext><![CDATA[<span class='treeItemInner'><span class='treeItemLeft'>Distributions</span></span>]]></itemtext>
	</item>    
	<item id="type5">
		<userdata name="url"><![CDATA[../monitor/monitor.html?type='EVENTS';'CONSET']]></userdata>
		<itemtext><![CDATA[<span class='treeItemInner'><span class='treeItemLeft'>Consistency data sets</span></span>]]></itemtext>
	</item>    
</tree>

I have standard inicializion, onlyu with attached event “onClick” - calling url in userdata.

What I have do wrong? Thanks for your answers.

Inicialization of tree

treeInstance = new dhtmlXTreeObject(id+"Tree", params.width, params.height, 0);
treeInstance.setSkin('dhx_skyblue');
	treeInstance.setImagePath(themePath+'images/dhtmlxtree/csh_dhx_skyblue/');
	treeInstance.enableDragAndDrop(false);
	treeInstance.enableTreeLines(false);
	treeInstance.enableTreeImages(false);
	treeInstance.setItemStyle("standartTreeRow", "standartTreeRowOver");
	treeInstance.loadXML(fdeTree.getDataUrl(id)); 
	treeInstance.setXMLAutoLoading(fdeTree.getDataUrl(id));
	treeInstance.attachEvent("onClick",function(aId){
		
		$(treeInstance._idpull[aId].span.parentNode.parentNode).attr("id", aId);
				
		if (idMenuItem != null) {
			$('#' + idMenuItem).removeClass("selectedTreeRow");
			$('#' + idMenuItem).addClass("standartTreeRow");
		} 
		
		idMenuItem = aId;
			
		$(treeInstance._idpull[aId].span.parentNode.parentNode).removeClass("standartTreeRow");
		$(treeInstance._idpull[aId].span.parentNode.parentNode).addClass("selectedTreeRow");
		
		if (treeInstance.getUserData(aId, "url")!= undefined) {
			ajaxAnywhere.getAJAX(treeInstance.getUserData(aId, "url"));
		}
		var unpackChild = treeInstance.getUserData(aId, "unpackchild");
		if (unpackChild != undefined && unpackChild) {
			var state = treeInstance.getOpenState(aId);
			if (state == "-1") {
				if (params.closeAllBeforeOpenOne == true) {
					treeInstance.closeAllItems(0); 
				}
				treeInstance.openAllItems(aId); 
			} else {
				treeInstance.closeAllItems(aId); 
			}
		}
		return true;
	});
	treeInstance.attachEvent("onMouseIn",function(id){
		$(treeInstance._idpull[id].span.parentNode.parentNode).removeClass("standartTreeRow");
		$(treeInstance._idpull[id].span.parentNode.parentNode).addClass("standartTreeRowOver");
		return true;
	});
	treeInstance.attachEvent("onMouseOut",function(id){
		$(treeInstance._idpull[id].span.parentNode.parentNode).removeClass("standartTreeRowOver");
		$(treeInstance._idpull[id].span.parentNode.parentNode).addClass("standartTreeRow");
		return true;
	});	

Hi,

select attribute highlights the item. If you want to call onClick event for this item, you need to set call attribute:

Yes, but I want only highligth item. But it does not work. If I try “call=1” item highlitghts after calling the url. But I want only highlight item. In the XML I see no error or is there?

If the “call” attribute isn’t set, onClick handler won’t be called and item will be highlighted (at least in 2.6 version).

Possibly in some old versions the onClick event is called by select attribute. In this case you may attach event handler after xml loading:

treeInstance.loadXML(fdeTree.getDataUrl(id),function(){ treeInstance.attachEvent("onClick",function(aId){ ... }); });

I have version v.2.6 build 100722 (professional licence) and with configuration and XML above the item is not highlighted. Something is wrong but I have no idea if I make a mistake or I dhtmlxtree.

Hello,

Locate the same xml highlights the first item. Could you please provide the complete demo to recreate the problem