Wijmo 5 - Context Menu on a FlexGrid
HTML
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.grapecity.com/wijmo/5.20182.524/styles/wijmo.min.css">
<script src="https://cdn.grapecity.com/wijmo/5.20182.524/controls/wijmo.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.20182.524/controls/wijmo.input.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.20182.524/controls/wijmo.grid.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.3/angular.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.20182.524/interop/angular/wijmo.angular.min.js"></script>
<div ng-app="app" ng-controller="appCtrl">
<wj-flex-grid
control="ctrl.control"
initialized="initGrid(s)"
selection-mode="CellRange"
allow-dragging="0"
items-source="ctrl.data"
control="grid"
initialized="init(grid)">
</wj-flex-grid>
<button ng-click="do()">
log ctrl.control
</button>
</div>
CSS
.wj-flexgrid {
height:300px;
margin-top: 45px;
}
JavaScript
// define app, include Wijmo 5 directives
var app = angular.module('app', ['wj']);
// controller
app.controller('appCtrl', function ($scope) {
$scope.ctrl = {};
$scope.ctrl.data = getData(50);
$scope.initGrid = function(grid){
// grid initialized
}
$scope.do = function(){
console.log($scope.ctrl.control);
}
});
function getData(count){
// create some random data
var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
data = [];
for (var i = 0; i < count; i++) {
data.push({
country: countries[i % countries.length],
downloads: Math.round(Math.random() * 20000),
sales: Math.random() * 10000,
expenses: Math.random() * 5000
});
}
return data;
}