We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

contex menu with angular 1

Thread ID:

Created:

Updated:

Platform:

Replies:

127092 Oct 25,2016 11:18 AM Nov 7,2016 12:12 PM JavaScript 5
loading
Tags: ejTreeGrid
Daniel
Asked On October 25, 2016 11:18 AM

I want to add a context menu with  options to predefined and you reach a function whit Angular Js 1









Attachment: Archivos_9ca9624b.7z

Suriyaprasanth Ravikumar [Syncfusion]
Replied On October 26, 2016 04:53 AM

Hi Daniel, 
Thanks for contacting Syncfusion support. 
Please find the response below: 
Query1: I want to add a context menu with  options to predefined and you reach a function whit Angular Js 1 
Solution: 
 Using contextMenuOpen client side event we can add custom menu items in TreeGrid. 
Please find the code snippet below. 
<div id="angulartreegrid" ej-treegrid 
                     e-datasource="data" 
                     e-contextmenuopen="contextmenuopen"> 
                </div> 
 
//Add custom menu item and handler fucntion 
function contextMenuOpen(args) { 
            var data; 
            data = args.item; 
            var contextMenuItems = [ 
             { 
                 headerText: "Custom", 
                 menuId: "Custom", 
                 eventHandler: customContextMenu, 
             } 
            ]; 
            args.contextMenuItems.push.apply(args.contextMenuItems, contextMenuItems); 
} 
function customContextMenu(args) { 
            alert("Custom context menu clicked"); 
} 
 
We have also prepared the sample for your reference. Please find the sample from below link 
Please find our online custom context menu sample link below 
For more information’s relates to custom context menu in TreeGrid please refer the following link. 
 
Please let us know if you require further assistance on this. 
 
Thanks&Regards, 
Suriyaprasanth R 


Daniel
Replied On October 26, 2016 07:53 AM

I want to point to a function within the angular controller within the angular scope, is this possible?

Jonesherine Stephen [Syncfusion]
Replied On October 27, 2016 07:05 AM

Hi Daniel, 
We can map the inline functions for context menu “eventHandler” to point the function within angular scope. 
Please find the code example below 
.controller('TreeGridCtrl', function ($scope) { 
                // 
            $scope.contextmenuopen = function contextMenuOpen(args) { 
            var data; 
            data = args.item; 
            var contextMenuItems = [ 
             { 
                 headerText: "Custom", 
                 menuId: "Custom", 
                 eventHandler:  function customContextMenu(args) { 
                                                  alert($scope.selectedRow); 
                                                  }, 
             } 
            ]; 
            args.contextMenuItems.push.apply(args.contextMenuItems, contextMenuItems); 
        };         
}); 
We have also modified the sample for your reference. Please find the sample from below link 
Please let us know if you require further assistance on this. 
Regards, 
Jone sherine P S 


Daniel
Replied On November 4, 2016 08:50 PM


what realmento wish it is that the context menu point to an angular function that is defined outside

Attachment: syn_f02b0558.rar

Jonesherine Stephen [Syncfusion]
Replied On November 7, 2016 12:12 PM

Hi Daniel, 
We can declare the “eventHandler” functions either inside/outside the angular scope and also we can define even handler as inline function or separate function. 
We can’t pass the custom arguments for event handler function, arguments will be passed from control while event is triggered. 
Please find the code example below. 
var contextMenuItems = [ 
               { 
                   headerText: "Custom", 
                   menuId: "Custom", 
                   eventHandler: $scope.ClickSubMenu, 
               } 
//handler function 
$scope.ClickSubMenu = function (args) 
           { 
               alert($scope.selectedRow); 
             } 
We have prepared the workaround and declared the “eventHandler” on outside of the “contextMenuOpen” action. 
Please find the sample from below location: 
 
Regards, 
Jone sherine P S  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;