I have a ui-grid configuration and the menu below, but I get a menu open for each displayed element (I know the problem is that the same menu opens for all elements, since there are no differentiation interference, of which the menu of elements is for opening, but I can not refer to it)
$scope.gridOptions = {
enableSelectAll: true,
exporterCsvFilename: 'AGS_Extract.csv',
exporterMenuPdf: false,
enableFiltering: true,
showGridFooter: true,
paginationPageSizes: [25, 50, 75],
paginationPageSize: 25,
useExternalPagination: true,
enableGridMenu: true,
exporterAllDataFn: function () {
var paramsObj = {};
var url = "http://test.satellite.com:8080/Dashboards/AGSMateervlet";
paramsObj['query'] = $scope.keyword;
paramsObj['start'] = 0;
paramsObj['rows'] = $scope.gridOptions.totalItems;
return $http.get(url, { params: paramsObj, headers: { 'Content-Type': 'application/json' } }).then(function (res) {
var myElement = angular.element(document.querySelectorAll(".custom-csv-link-location"));
$scope.gridApi.exporter.csvExport( $scope.export_row_type, $scope.export_column_type, myElement );
});
},
columnDefs: [
{ name: 'materialnum', displayName: 'Part Number', cellClass: 'partNum',
cellTemplate: "<div> <div ng-click='grid.appScope.cellClicked(row)' class='ui-grid-cell-contents' title='{{COL_FIELD CUSTOM_FILTERS}}'>{{COL_FIELD CUSTOM_FILTERS}}</div><div class='subMenu' ng-show='grid.appScope.menu'><div class='subMenuChld'><span class='arrwLeft'></span><h5>View Details <span style='float:right;' ng-click='grid.appScope.menu=false;'>X</span></h5><ul><li ng-click='grid.appScope.menuItemClick(row,'new_price')'>New Price</li><li ng-click='grid.appScope.menuItemClick(row,'usage_forecast')'>Usage/Forecast</li><li ng-click='grid.appScope.menuItemClick(row,'inventory')'>Inventory</li><li ng-click='grid.appScope.menuItemClick(row,'part_bom')'>Part BOM</li><li ng-click='grid.appScope.menuItemClick(row,'open_order')'>Open Order</li><li ng-click='grid.appScope.menuItemClick(row,'open_po')'>Open PO</li><li ng-click='grid.appScope.menuItemClick(row,'return_history')'>Return History</li><li ng-click='grid.appScope.menuItemClick(row,'supplier_history')'>Supplier History</li><li ng-click='grid.appScope.menuItemClick(row,'repair_history')'>Repair History</li><li ng-click='grid.appScope.menuItemClick(row,'alternative_parts')'>Alternative Parts</li></ul></div></div></div>"
},
{ name: 'materialdesc', displayName: 'Part Description',
cellTemplate:'<div ng-if="row.entity.materialdesc" title="{{row.entity.materialdesc}}">{{row.entity.materialdesc}}</div><div ng-if="!row.entity.materialdesc"></div>',
},
{
name: 'sparable', displayName: 'Sparable',
filter: {
type: uiGridConstants.filter.SELECT,
selectOptions: [
{ value: 'yes', label: 'YES' },
{ value: 'no', label: 'NO' }
]
},
//cellTemplate:'<div ng-if="row.entity.sparable" class="tcenter">{{row.entity.sparable}}</div><div ng-if="!row.entity.sparable" class="tcenter">-</div>',
cellClass: function (grid, row, col) {
if (grid.getCellValue(row, col) === 'NO') {
return 'red tcenter';
}
if(grid.getCellValue(row, col) === 'YES') {
return 'green tcenter';
}
return 'tcenter';
}
},
..
The following is the function that is called when you click on it:
$scope.cellClicked = function (row, col){
console.log(row.entity.materialnum);
$scope.menu = true;
};
In addition to displaying all menus, the layout of the menu is now irrelevant. How can I position or point to the correct click position (this is simple in jquery, but I strictly use javascript, angularjs and ui-grid).
Thanks in advance!
#EDIT
#, ; ; jquery, , jquery, - angular javascript .
25 , 10-12 , ; , , , , , , ( , ul/li , , . ( z- , ). :

