JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<!DOCTYPE html>
<html ng-app="App">
<head>
<title>Flexmonster/AngularJS</title>
<!-- AngularJS -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.js"></script>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<!-- Flexmonster -->
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<style type="text/css">
.link {
text-decoration: underline !important;
cursor: pointer;
color: #726b04 !important;
}
</style>
<script type="text/javascript">
angular.module("App", ["flexmonster"]);
angular.module('App').controller('PivotCtrl', ['$scope', PivotController]);
function PivotController($scope) {
$scope.report = {
"dataSource": {
"filename": "data/data.json"
},
"slice": {
"rows": [{
"uniqueName": "Country"
}, {
"uniqueName": "Color"
}],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Price"
}]
}
}
var selectedRows = {};
$scope.customizeCellFunction = function(cell, data) {
const nonExpandable = ["Australia", "Canada", "Germany", "France"];
if (data.hierarchy &&
data.hierarchy.uniqueName == "Country" &&
data.member &&
nonExpandable.includes(data.member.caption)) {
cell.text = `
<input type="checkbox" name="checkbox" value="${data.value}"
onclick="preventExpand(event)"
onchange="onCheck(event, '${data.member.caption}')"
${selectedRows[data.member.caption] ? 'checked' : ''}>
<span> ${data.member.caption}</span>`;
}
}
window.preventExpand = function(e) {
e.stopImmediatePropagation();
}
onCheck = function(e, name) {
selectedRows[name] =...