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

How can I get the unique name of the column click when OnRowContextMenu fires client side

2 Answers 8 Views
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 05 Feb 2018, 03:05 PM

I have a radgrid which has a context menu attached to it (this is not a header context menu).

I need to customize the context menu based upon which column has been clicked.

How to I retrieve the unique name of the column that has been clicked when the OnRowContextMenu  event fires in javascript?

Can you please point me to documentation that provides this information or failing that provide a code snippet.

 

e.g.

 

var TelerikRowContextMenu =  function (sender, eventArgs) {
            var objEventTarget = eventArgs.get_domEvent();
 
            var lngRowNumber = eventArgs.get_itemIndexHierarchical();

            var strColumnUniqueName = ??????????????????????????;

 

}

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Feb 2018, 08:26 AM
Hello, Alan,

Thank you for writing.  

I would like to note that this forum is related to the Telerik UI for WinForms suite. Hence, we can provide you a solution for this product. The following help article demonstrates a sample approach how to control what context menu to be displayed considering the cell and its column: https://docs.telerik.com/devtools/winforms/gridview/context-menus/conditional-custom-context-menus

However, it seems that your question is not related to WinForms. Feel free to post your inquiries in the relevant forum. Thus, the respective community will gladly assist you: https://www.telerik.com/forums

I hope this information helps. Should you have further questions I would be glad to help. 
 
 Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Alan
Top achievements
Rank 1
answered on 06 Feb 2018, 09:19 AM

Thanks - Sorry for the misplaced post:

 

In case anyone else finds this post on a search and wants to know the answer the following code works.

 

Alan

 

        TelerikRowContextMenu:  function (sender, eventArgs) {
 
            var lngRowNumber = eventArgs.get_itemIndexHierarchical();
            var lngColumnIndex = eventArgs.get_domEvent().target.cellIndex;
            var strUniqueName = $find(myGridID).get_masterTableView().get_columns()[lngColumnIndex].get_uniqueName();

           .........

     }

Asked by
Alan
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Alan
Top achievements
Rank 1
Share this question
or