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

Selecting A Row On Right-Click/Context Menu Popup

2 Answers 223 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Seth
Top achievements
Rank 1
Seth asked on 10 Mar 2008, 02:23 PM
In the RadControls for ASP.NET version, I was able to select a row when a user right clicked for a context menu using the ClientEvents OnRowContextMenu event:

function CabinetRowContextMenu(index, e)  
{  
     document.getElementById("radGridClickedRowIndex").value = index;  
     var menu = <%= rmCabinets.ClientID %>;  
     menu.Show(e);  
                  
     e.cancelBubble = true;  
     e.returnValue = false;  
 
     if (e.stopPropagation)  
     {  
          e.stopPropagation();  
          e.preventDefault();  
     }  
     this.SelectRow(this.Rows[index].Control, true);  
}  
 

I was also able to get the row index of the selected row using:
rgItemCategories.MasterTableView.SelectedRows[0].Index 

I assumed that the following was the equivalent for Prometheus:
var rgCabinets = $find("<%= rgCabinets.MasterTableView.ClientID %>");  
var selectedItems = rgCabinets.get_selectedItems();  
 
selectedItems[0].get_index(); 
 
But that doesn't seem to work and the documentation online does not have a valid page for this property/method.

How can I achieve these 2 things?

Seth

2 Answers, 1 is accepted

Sort by
0
Seth
Top achievements
Rank 1
answered on 11 Mar 2008, 03:40 PM
I have solved this.

function OnRowContextMenuFolderTypes(sender, eventArgs)  
{  
     var rgGrid = $find("<%= rgGrid.MasterTableView.ClientID %>");  
     rgGrid.selectItem(eventArgs.get_itemIndexHierarchical());               
}  
 
0
Sebastian
Telerik team
answered on 11 Mar 2008, 03:42 PM
Hello Seth,

You may also refer to this code library thread and for more examples about how to use RadMenu as context menu in RadGrid:

http://www.telerik.com/community/code-library/submission/b311D-kmaah.aspx

or this KB article:

http://www.telerik.com/support/kb/article/b454K-kgt-b454T-cbb-b454c-cbb.aspx

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Seth
Top achievements
Rank 1
Answers by
Seth
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or