Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by ravi raman on Apr 02, 2008 03:26
open dhtmlx forum
how to add dblclick event to grid

Hi,
i have a grid with data whr user can double click on perticular row to get the the detail screen , now i need to attach dblclick event in the grid so tht on dblclick event i can call my function , i have tried with is sample code but i am not able to get the event

mygrid.attachEvent("ondblclick",function(event_object){
         alert("click");
         alert(event_object);
        return true;
        });
i am able to get on selection of row using mygrid.setOnRowSelectHandler(doOnRowSelected);

is the syntax correct , need ur advice
thanks in advance.

regards
ravi.
Answer posted by Support on Apr 02, 2008 03:55
>>mygrid.attachEvent("ondblclick",function(event_object){
The event name is case sensitive, so correct test is
    mygrid.attachEvent("onDblClick",function(event_object){

By the way, same as onRowSelect it has deprecated alias -  setOnDblClickHandler
Answer posted by ravi on Apr 02, 2008 08:11

Hi ,

i tried with your code , but still i am not able get the event .please find my sample code .

in this only onKeyPress is being called rest other its not happening.

 

mygrid = new dhtmlXGridObject('gridbox');
 mygrid.setImagePath("../../codebase/imgs/");
 mygrid.setHeader("Column A, Column B, Column C, Column D");
 mygrid.setInitWidths("100,250,80,*")
 mygrid.setColAlign("right,left,center,center")
 mygrid.setColTypes("ro,ro,ch,price");
 mygrid.setColSorting("int,str,str,str")
 

 mygrid.attachEvent("onDblClick",function(event_object){
      alert("click");
      alert(event_object);
      return true;
  });

  mygrid.attachEvent("onClick",function(event_object){
      alert("click");
      alert(event_object);
      return true;
  });

  mygrid.attachEvent("onKeyPress",function(keycode,ctrl,shift,event_object){
     if(event.keyCode == 10 ||event.keyCode == 13){
       event.keyCode=9;
   alert(event_object);
   }
  }) 

 mygrid.init();
 mygrid.loadXML("grid.xml");

Answer posted by Support on Apr 02, 2008 08:56
Please refer to the
    http://dhtmlx.com/docs/products/dhtmlxGrid/doc/events.html#grid_api_ev
it contains full list of supported events and their correct names ( the events marked with * available only in pro version )