Wijmo 5 - FlexGrid in Boostrap Accordion
HTML
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="http://cdn.wijmo.com/5.20152.70/controls/wijmo.min.js"></script>
<link rel="stylesheet" href="http://cdn.wijmo.com/5.20152.70/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.20152.70/controls/wijmo.grid.min.js"></script>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="http://cdn.wijmo.com/5.20152.70/controls/wijmo.input.min.js"></script>
<script src="http://cdn.wijmo.com/5.20152.70/interop/angular/wijmo.angular.min.js"></script>
<!-- mark this as an Angular application and give it a controller -->
<div ng-app="app" ng-controller="appCtrl">
<wj-flex-grid items-source="data" selection-mode="Row" wj-context-menu="#idMenu" control="flex">
<wj-flex-grid-column header="Country" binding="country"></wj-flex-grid-column>
<wj-flex-grid-column header="Sales" binding="sales"></wj-flex-grid-column>
</wj-flex-grid>
<wj-menu id="idMenu" ng-show="false">
<wj-menu-item cmd="cmdAdd" cmd-param ="1">Add Row</wj-menu-item>
<wj-menu-item cmd="cmdRemove" cmd-param="2">Remove Row</wj-menu-item>
</wj-menu >
</div>
JavaScript
// define app, include Wijmo 5 directives
var app = angular.module('app', ['wj']);
// controller
app.controller('appCtrl', function ($scope) {
// create some random data
var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
data = [];
for (var i = 0; i < 1; i++) {
data.push({
country: countries[i],
downloads: Math.round(Math.random() * 20000),
sales: Math.random() * 10000,
expenses: Math.random() * 5000
});
}
// expose data as a CollectionView to get events
$scope.data = new wijmo.collections.CollectionView(data);
$scope.cmdAdd = function(){
$scope.data.addNew();
$scope.data.moveCurrentToLast();
setTimeout(function () {
$scope.flex.startEditing(true, $scope.flex.rows.length - 1, 0);
}, 0);
}
});