Get the position of item

hi everybody,
i have a problem. how can i get the position of item. like item.offset.top and item.offset.left.
normal document object can get position as below. i wander if item of dhtmlxtree can.

  var docObj1 = $('#books').offset();//api of jquery
  alert(docObj1.left);
  alert(docObj1.top);

due to the requirement that i want to draw a line from one item to another item of another tree. so i need to get the position data of items in the first place. i dont know whether dhtmlxtree has other good methods more convenient to implement the requirement.

thank you
best regards
Allen Duan

You can get tree item DOM object reference with following code:

tree._idpull[itemId].htmlNode

where itemId - id of tree item

hi Olga,
i used the code u provide. as below.

var itemOb = tree._idpull["books"].htmlNode;

an error occured: “tree._idpull.books is null or is not an object.”
books exists definitely.
my dhtmlxtree version is 1.3.
my problem is about version?

best regards
thank you very much

Allen Duan

Yes, try to update your dhtmlxTree version

hi olga
my dhtmlxtree’s version is 1.5.
how can i get DOM object?
i tried the method u provided~
it doesnt work.
do i forget import some js?

thx
best regards
Allen Duan

dhtmlxTree version 1.5 is not supported now. It’s better to update dhtmlxTree version.

Is “books” item loaded in tree ? If you need to get item position right after xml loading, you need to call this function from the loading end handler:

tree.loadXML(“tree.xml”,doAfterLoading);

function doAfterLoading(){
var obj = tree._idpull[“books”].htmlNode;

});