Hi all.
I have come across some very weird behaviour with the Rad Grid and a context menu.
It seems that the OnRowContextMenu event has some problems getting the correct row that was clicked ... the value retrieved from eventArgs.get_itemIndexHierarchical() method returns a different index depending on where in the row the mouse is clicked. If I click in the centre of the row, most of the time it is fine. But if I click near the top or bottom of the row, I get a different index returned (even though it is still the same row). This is slightly less of an issue in IE than in Firefox + Chrome.
Has anyone else encountered this? Is it a known issue? It is making the context menu very unreliable and impossible to use.
OnRowContextMenu handler:
I have come across some very weird behaviour with the Rad Grid and a context menu.
It seems that the OnRowContextMenu event has some problems getting the correct row that was clicked ... the value retrieved from eventArgs.get_itemIndexHierarchical() method returns a different index depending on where in the row the mouse is clicked. If I click in the centre of the row, most of the time it is fine. But if I click near the top or bottom of the row, I get a different index returned (even though it is still the same row). This is slightly less of an issue in IE than in Firefox + Chrome.
Has anyone else encountered this? Is it a known issue? It is making the context menu very unreliable and impossible to use.
OnRowContextMenu handler:
function
rowContextMenu(sender, eventArgs) {
var
menu = $find(
"<%= menuDrivers.ClientID %>"
);
var
evt = eventArgs.get_domEvent();
if
(evt.target.tagName ==
"INPUT"
|| evt.target.tagName ==
"A"
)
return
;
// Get trip ID + type from source row
var
index = eventArgs.get_itemIndexHierarchical();
var
row = sender.Control.children[1].children[0].rows[parseInt(index)];
var
rowElements = row.getElementsByTagName(
"input"
);
alert(sender);
alert(
'Row index '
+ index +
' clicked. Trip ID is '
+ rowElements[0].value);
// Store the trip ID and type in hidden fields
$get(
"ContextTripID"
).value = rowElements[0].value;
$get(
"ContextTripType"
).value = rowElements[1].value;
// more code continues here ...
}