Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jon on Sep 11, 2008 18:44
open dhtmlx forum
GRID: Turn off LightMouseNavigation when mouse moves outside grid.

Hi,

I want to "un-hilight" rows when the user moves the mouse outside a grid with enableLightMouseNavigation=true;

I found the following solution already provided by you...

>> There is no API call , but can be done with next two lines of code
>>
>> mygrid = new dhtmlXGridObject('gridbox');
>> ....
>> dhtmlxEvent(mygrid.entBox,"mousemove",function(e){ (e||event).cancelBubble=true;});
>> dhtmlxEvent(document.body,"mousemove",function(){ mygrid.clearSelection(); });


But there are 3 problems with it:

1. If a cell is being edited, and the user moves the mouse away from the grid, then the active cell is un-selected as well. I want the hilighting to be removed ONLY IF a cell is not currently being edited.

2. The above method breaks with cells of type CO, CORO and TXT. When the user moves the mouse over the resulting dropdown list or textarea, it is treated as though the mouse has moved out of the grid, and the cell's object disappears.

3. The LightMouseNavigation does not turn off when the User moves over the HEADER of the table. The top row of the grid remains hilighted.

My Question: Is there a function that I can call manually to "un-highlight" any rows, so that I can write a custom code to handle the requirements (1-3) above?

Thanks,
Jon
Answer posted by Support on Sep 12, 2008 03:48
In "lightMouseSelection" mode - the row under mouse not just highlighted, but selected, so you can use only clearSelection to remove visual effect. 

Technically you can 
a) continue to use lightMouseSelection mode but with updated code
 dhtmlxEvent(document.body,"mousemove",function(){ if (!mygrid.editor) mygrid.clearSelection(); });

or 

b) use row-hovering mode instead
         http://dhtmlx.com/docs/products/dhtmlxGrid/samples/styles_skins/pro_grid_hover.html?un=1221217805000