I want to add a context menu with options to predefined and you reach a function whit Angular Js 1
<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");
} |
I want to point to a function within the angular controller within the angular scope, is this possible?
.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);
};
}); |
var contextMenuItems = [
{
headerText: "Custom",
menuId: "Custom",
eventHandler: $scope.ClickSubMenu,
}
//handler function
$scope.ClickSubMenu = function (args)
{
alert($scope.selectedRow);
} |