Skip to content

Instantly share code, notes, and snippets.

@OscarAgreda
Created February 26, 2015 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save OscarAgreda/49b4e2ac3d7b22920311 to your computer and use it in GitHub Desktop.
Save OscarAgreda/49b4e2ac3d7b22920311 to your computer and use it in GitHub Desktop.
<style>
* {
font-family: Verdana;
}
.node {
border: solid 1px white;
font: 10px sans-serif;
line-height: 12px;
overflow: hidden;
position: absolute;
text-indent: 2px;
}
</style>
<section ng-controller="invoicePivot">
<div class="container-fluid ">
<div class="row">
<div id="invoicesPivotTableOutput"></div>
</div>
</div>
</section>
'use strict';
(function() {
angular.module('app').controller('invoicePivot', invoicePivot);
function invoicePivot($scope, $http) {
$scope.invoices = [];
getInvoices();
/*********************************************************
* Region get data
*********************************************************/
function getInvoices() {
var entity = 'Invoice';
var resource = 'getInvoices';
var url = 'http://' + window.location.host + '/api/' + entity + '/' + resource;
return $http.get(url, { cache: true }).
success(function (data) {
$scope.invoices = data;
pivotUi();
}).
error(function (error) {
});
}
function pivotUi() {
// wiki https://github.com/nicolaskruchten/pivottable/wiki/Aggregators
var renderers = $.extend($.pivotUtilities.renderers, $.pivotUtilities.gchart_renderers, $.pivotUtilities.d3_renderers);
$("#invoicesPivotTableOutput").pivotUI($scope.invoices, {
renderers: renderers,
rows: ["PrintDocNumber"],
cols: ["IsPrinted"],
rendererName: "Table"
});
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment