Flexmonster - Cell renderer demo
Demos
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<script>
function onValueChange(evt){
console.log(evt.value);
}
</script>
<div id="pivot-container"></div>
CSS
#fm-pivot-view .fm-grid-layout div.fm-cell div.editable-cell{
z-index: 9999 !important;
position: relative !important;
border: 0px !important;
width: 100% !important;
height: 100% !important;
}
#fm-pivot-view .fm-grid-layout div.fm-cell div.editable-cell input[type=number]{
background-color: transparent !important;
padding: 7px 4px !important;
border: 0px !important;
width: 100% !important;
height: 100% !important;
color: blue !important;
}
JavaScript
new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 430,
toolbar: true,
customizeCell: customizeCellFunction,
report: {
"dataSource": {
"type": "csv",
"filename": "https://cdn.flexmonster.com/data/data.csv"
},
"slice": {
"rows": [{
"uniqueName": "Country"
}, {
"uniqueName": "Business Type"
}],
"columns": [{
"uniqueName": "Color"
}, {
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Quantity",
"aggregation": "percentofcolumn"
}],
"expands": {
"expandAll": true
}
},
"options": {
"drillThrough": false
}
}
});
function customizeCellFunction(cell, data) {
if (data.type == "value" && !data.isDrillThrough && !data.isGrandTotal && data.rowIndex == 2){
var value='';
if(data.value){
value = data.value;
}
cell.text = "<div class='editable-cell'><input type='number' value='"+ value + "' onchange='onValueChange(this);' /></div>";
}
}