Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nicolas Darques on Dec 06, 2007 08:36
open dhtmlx forum
dhtml tree keyboard navigation event ?

Hello I was wondering if there was a way of attaching an event upon keyboard navigation in the Tree. I've read through your documentation but could not find anything. The onSelect event doesn't work, and I don't see anything else that would work.

any Ideas ?

Nicolas Darques
Answer posted by Support on Dec 06, 2007 10:09
The onSelect event must fire if your keyboard actions cause change of currently selected item in tree

    tree.attachEvent("onSelect",function(){
       code here
    });

or, for older versions of tree

    tree.setOnSelectStateChange(function(){
       code here
    });

It pretty easy to update code so it will generate necessary events.
Please check dhtmlxgrid_kn.js , there are such functions as

dhtmlXTreeObject.prototype._onkey_down=function(id){
dhtmlXTreeObject.prototype._onkey_up=function(id){

you can add in end of such functions line similar to next

this.callEvent("onKeyNavigation",[]);

Such modification will introduce new event which can be attached and used in default way