This is a migrated thread and some comments may be shown as answers.

Grid Row Offset Issue

5 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 12 Apr 2011, 11:54 PM
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:

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 ...
 
}

5 Answers, 1 is accepted

Sort by
0
Ryan
Top achievements
Rank 1
answered on 14 Apr 2011, 05:57 AM
Anyone? This is having a serious impact on the client's site ...
0
Martin
Telerik team
answered on 18 Apr 2011, 08:52 AM
Hello Ryan,

I have tried to reproduce the issue in IE9, FF4, Chrome10, but without success. Could you please verify the exact version of RadControls that you are using?

Attached is a small sample that runs as expected on my side. Please give it a try and let me know how it goes.

All the best,
Martin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ryan
Top achievements
Rank 1
answered on 18 Apr 2011, 11:29 PM
Hi Martin,

Your example does indeed work as expected, but I have no idea why my solution does not. I am using version 2010.3.1109.40 of the controls. Would you like me to send you the page in its entirety? Or should I submit a support ticket?
0
Martin
Telerik team
answered on 19 Apr 2011, 07:52 AM
Hello Ryan,

I have tried to reproduce the issue using version 2010.3.1109.40 of the controls, but the sample project from my previous post still works as expected. My suggestion is to upgrade to the latest version of RadControls and verify whether the problem still exists. In this case please consider opening a formal support ticket and send me a runnable demo page that I could debug locally. This way I will be able to provide you with more to the point resolution.

Regards,
Martin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ryan
Top achievements
Rank 1
answered on 21 Apr 2011, 01:25 AM
Hi Martin,

Thanks for your assistance. Whilst creating a demo project to demonstrate the issue, I discovered the problem. I had a nested div within each row in the grid that was slightly offset so that it was out of alignment with the row. This was obviously throwing off the position when clicking within this div.

All is good now, thanks :)
Tags
Grid
Asked by
Ryan
Top achievements
Rank 1
Answers by
Ryan
Top achievements
Rank 1
Martin
Telerik team
Share this question
or