Select or highlight the Row when Context Menu is selected


Is there any way to select the Row when I right click on it with Context Menu attached?

I am trying to do selectRowById within a function of “onBeforeContextMenu”. But it doesnt work and it kills Context Menu.
Here is what I am trying to do.

return true;//block context menu

I tried both selectRowById and selectRow.

Following code works as expected at local exampel:

mygrid.attachEvent("onBeforeContextMenu",function(rowId,celInd,obj){ obj.selectRow(rowId); return true; });

What browser/Grid version are you using?

I am actually asking on the wrong thread. I am having problems with DhtmlxTree

I am using
dhtmlxSuite 2010 Rel.1 (DHTMLX 2.6) Professional edition build 100916(with IE9 fix applied) + dhtmlxChart 2.6.5 and IE8.

I was using onBeforeContextMenu as you suggested but when I add selectRow to it it kills context menu and gives javascript error
“‘undefined’ is null or not an object” on this row

Sorry My Bad!

I should have used selectItem instead.

With selectItem it works with no problem.

Sorry again

Hey this works great for me when using the grid. One followup question I had was how can I fire my onRowSelect handler after the row is selected in this onBeforeContextMenu function.