How can set the cursor in a tree in a dhtmlxlayout container : myatree = leftLayout.cells(“a”).attachTree(“0”);
I have a function whereby I reorder tree nodes (after a node move or delete). Reordering can take seconds and so I want to set the cursor to an hourglass but although I can amend the varaibles below the cursor stays as either a pointer or arrow.
myfunc()
{
var pointer=mytree.style_pointer; // == “pointer”
mytree.style_pointer = “wait”; // I’ve also tried document.body.style.cursor = “wait”;
:
mytree.style_pointer = pointer;
}
There isn’t public method to dynamically change tree cursor. Cursor should be set before items are added and can’t be changed by style_pointer property.
To change it you can use onMouseIn event handler:
show_wait = false
tree.attachEvent(“onMouseIn”,function(id){
tree._idpull[id].span.parentNode.style.cursor = (show_wait?“wait”:“pointer”);
return true
})
Doesn’t seem to work at least in the way I want it to.
1) I added the event and added a global show_wait = false;
2) and in myfunc() at the start I have
a) show_wait = true;
and at the end of the func
b) show_wait = false;
but the cursor does not change unless I remove this b) show_wait = false;
and even then the cursor only changes to an hourglass after myfunc
appears to have finished ie reordered nodes
(note myfunc() reordering involves using ajax to rename nodes - files- on the server)
Please check that show_wait variable is change as you expect. Please provide the sample to recreate the issue if the issue still occurs.
Problem is due to already in an event handler :
function tOnDrop(sid, tid, bid)
{
show_wait = true;
rename dirs/files on server and in tree
show_wait = false;
}
and so only enters tree.attachEvent(“onMouseIn”,function(id){}
after tOnDrop() completes
onMouseIn event is called only once - when target item changed. So possibly you need to change cursor directly in the onDrop event handler:
function tOnDrop(sid, tid, bid)
{
tree._idpull[tid].span.parentNode.style.cursor = “wait”;
rename dirs/files on server and in tree
tree._idpull[tid].span.parentNode.style.cursor = “pointer”;
}