I have similar code:
<script>
$(document).ready(function () {
var data = @Html.Raw(ViewBag.Data);
function sumPreviousValues(instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.TextRenderer.apply(this, arguments);
td.val = 'SUM SEVERAL PREVIOUS CELLS';
}
container = document.getElementById('example1'),
settings1 = {
data: data,
colHeaders: @Html.Raw(ViewBag.TableHeader),
cells: function (row, col, prop) {
var cellProperties = {};
if (col == 16) {
cellProperties.renderer = sumPreviousValues;
}
return cellProperties;
}
},
hot = new Handsontable(container,settings1);
hot.render();
The key is to modify the function sumPreviousValues()
But I dont know how to access the td
value ? and if it is possible to access other cells' value like td[index]
.
Any idea? I didn't find options in documentation.
Thank you