3.0.5

Are you discarding right-click somehow?

I am trying to catch a right-click within the grid with this code:

function myRightClick(event)
{
alert("I'm here");
}

gridObject.setEvent("onclick", myRightClick);

On a left click the event fires fine but on a right click nothing happens.
Chadd Whistler
March 1,
The right mouse click is 'oncontextmenu' event in IE. By default it is disabled in the Active.System.Control class. You should be able to set your handler like this:

obj.setEvent("oncontextmenu", myRightClick);
Alex (ActiveWidgets)
March 1,
Hi,

I tried this and my "MyRightClick" is working then the IE context menu apears, How can I avoid this....

thnks in advance....
Ahmad Naser
April 27,
You would need to return a false from your myRightClick function.
Peter
April 27,
Try using this, that way when you right click it will select the current item your mouse is over :)


function itemRightClick(e) {
e.cancelBubble = true;
e.returnValue = false;

var tempDat = 'asdf' + (event.clientY / 20); //Divide by the ColumnHeaderHeight
tempDat = tempDat.split("."); //Split rather than round to be more accurate

var tempSelectIndex = (tempDat[0].replace('asdf', '') * 1) - 1;
items.setProperty("selection/index", tempSelectIndex);
}


gridObject.setEvent("oncontextmenu", itemRightClick);
Tako
May 9,
Tako,

I am trying to use the code you posted but I don't know where you got the "items" from in your "itemRightClick" method. Could you please advise? Thanks.

Rashad Rivera
May 15,
sorry, instead of items.setProperty it should be gridObject.setProperty
May 16,
Tako,

Your code seems to work fine (Thanks!), but it selects the wrong row in my case because my grid isn't at the top of the page. Does anyone know if there's a more accurate way of figuring out what row you clicked on?

And, I'm wondering if there's a way to do this without actually selecting the row. I may have one row selected, but I want to see context data on a right-clicked row without deselecting the previously selected row. Maybe I'm reaching, but that's what I'm after...
Pete
August 18,

This topic is archived.

See also:


Back to support forum