Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by martin on Mar 16, 2009 08:30
open dhtmlx forum
onRowSelect event fires on mouseover instead of click when using dhtmlXGridFromTable


I've just found that creating grid from table with dhtmlXGridFromTable the onRowSelect fires on mouseover
(tested on Firefox /Opera)

To reproduce it, it can be tested with the following html:

<table id="car" style="width:100%" lightnavigation="true"
imgpath="grid/codebase/imgs/" gridHeight="520px">
<tr>
<td type="ro">Super</td>
<td width="40">Precio</td>
</tr>
<tr>
<td>Aguacate </td>
<td>4.15</td>
</tr><tr>
<td>test </td>
<td>1.98</td>
</tr>
</table>
<script>
    mygrid = new dhtmlXGridFromTable('car');
    mygrid.setInitWidths("100,250")
    mygrid.setColAlign("right,left")
    mygrid.setColTypes("ro,ro");
    mygrid.setColSorting("int,str")
    
var timer_func=null;
mygrid.attachEvent("onRowSelect",function(){
window.clearTimeout(timer_func);
timer_func = window.setTimeout(function(){
alert("single");
},300);
});
</script>
Answer posted by dhxSupport on Mar 17, 2009 04:00
What is a reason of using setTimeout function? Without this function "onRowSelect" event works as expected.
Answer posted by Martin on Mar 17, 2009 04:07

Thanks for your reply,

the reason to use setTimeout is that I wanted to differentiate click from doubleClick and read this on another topic in the knowledge base.

Answer posted by Support on Mar 17, 2009 05:54
>>the onRowSelect fires on mouseover
Caused because of 
       <table id="car" style="width:100%" lightnavigation="true"  imgpath="grid/codebase/imgs/" gridHeight="520px"> 
If you need just a highlight row under cursor, remove this attribute and use 
       mygrid.enableRowsHover(true,"some_css_class");

Answer posted by Martin on Mar 17, 2009 07:28
Thanks very much for your support!