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

3 posts, 1 answers
  1. Alan
    Alan avatar
    10 posts
    Member since:
    Aug 2016

    Posted 05 Feb 2018 Link to this post

    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. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3201 posts

    Posted 06 Feb 2018 Link to this post

    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.
  3. Alan
    Alan avatar
    10 posts
    Member since:
    Aug 2016

    Posted 06 Feb 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    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();

               .........

         }

Back to Top