我有一个要求,在 ag-grid 中,我需要打开一个菜单来添加/编辑/删除该行数据。我正在使用角度材质菜单组件作为单元格模板 url。但是当单击该菜单项时,它不会触发 ag-grid 中的 onCellClicked 事件以获取对单击的行数据的引用,但是如果我单击远离菜单项的像素,则会触发事件。需要帮助弄清楚,如何在菜单单击时获取行数据。
我的 ag-grid 代码在这里:
var columnDefs = [
{headerName: "", field: "icon", width:65},
{headerName: "Categories",field:"category_name", width:1025, cellRenderer:function(params){
// my cell renderer code goes here
},
onCellClicked:function(params){
console.log("Cell is still getting click "+params.data);
//This click does not work
},
{headerName: "", field: "options", width:87, suppressMenu: true, templateUrl:"partials/options.html"
}
];
选项.html
<md-menu>
<!-- <md-button aria-label="Open phone interactions menu" class="md-icon-button" ng-click="openMenu($mdOpenMenu, $event)">
<md-icon md-svg-src="images/icons/options.svg" aria-label="android "></md-icon>
</md-button> -->
<a href="javascript:void(0)" class="option-btn" ng-click="openMenu($mdOpenMenu, $event)">options</a>
<md-menu-content width="4">
<md-menu-item>
<md-button ng-click="modifyOptions($event)">
<md-icon md-svg-src="images/icons/add.svg" aria-label="android "></md-icon>
Add
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="toggleNotifications()">
<md-icon md-svg-src="images/icons/edit.svg" aria-label="android "></md-icon>
Edit
</md-button>
</md-menu-item>
<md-menu-divider></md-menu-divider>
<md-menu-item>
<md-button disabled="disabled" ng-click="checkVoicemail()">
<md-icon md-svg-src="images/icons/delete.svg" aria-label="android "></md-icon>
Delete
</md-button>
</md-menu-item>
</md-menu-content>