mirror of
https://github.com/getredash/redash.git
synced 2026-03-23 04:00:09 -04:00
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
var renderers = angular.module('redash.renderers', []);
|
|
|
|
renderers.directive('pivotTableRenderer', function () {
|
|
return {
|
|
restrict: 'E',
|
|
scope: {
|
|
queryResult: '='
|
|
},
|
|
template: "",
|
|
replace: false,
|
|
link: function($scope, element, attrs) {
|
|
$scope.$watch('queryResult && queryResult.getData()', function (data) {
|
|
if (!data) {
|
|
return;
|
|
}
|
|
|
|
if ($scope.queryResult.getData() == null) {
|
|
} else {
|
|
// We need to give the pivot table its own copy of the data, because its change
|
|
// it which interferes with other visualizations.
|
|
var data = $.extend(true, [], $scope.queryResult.getData());
|
|
var renderers = $.extend($.pivotUtilities.renderers,
|
|
$.pivotUtilities.export_renderers)
|
|
$(element).pivotUI(data, {
|
|
renderers: renderers
|
|
}, true);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}); |