{"id":8018,"date":"2015-11-21T13:38:40","date_gmt":"2015-11-21T13:38:40","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/11\/21\/handsontable-how-to-change-cell-value-in-render-function-open-source-projects-handsontable-handsontable\/"},"modified":"2022-08-30T15:03:04","modified_gmt":"2022-08-30T15:03:04","slug":"handsontable-how-to-change-cell-value-in-render-function-open-source-projects-handsontable-handsontable","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/11\/21\/handsontable-how-to-change-cell-value-in-render-function-open-source-projects-handsontable-handsontable\/","title":{"rendered":"Handsontable : how to change cell value in render function-open source projects handsontable\/handsontable"},"content":{"rendered":"<p>I have similar code:<\/p>\n<pre><code>\n$(document).ready(function () {\n    var data = @Html.Raw(ViewBag.Data);\n\nfunction sumPreviousValues(instance, td, row, col, prop, value, cellProperties) {\n  Handsontable.renderers.TextRenderer.apply(this, arguments);\n    td.val = 'SUM SEVERAL PREVIOUS CELLS';\n}\n\n     container = document.getElementById('example1'),\n      settings1 = {\n        data: data,\n        colHeaders: @Html.Raw(ViewBag.TableHeader),\n        cells: function (row, col, prop) {\n            var cellProperties = {};\n\n            if (col == 16) {\n                cellProperties.renderer = sumPreviousValues;\n            }\n    return cellProperties;\n        }\n      },\n\n    hot = new Handsontable(container,settings1);\n    hot.render();\n<\/code><\/pre>\n<p>The key is to modify the function <code>sumPreviousValues()<\/code><\/p>\n<p>But I dont know how to access the <code>td<\/code> value ? and if it is possible to access other cells&#8217; value like <code>td[index]<\/code>. Any idea? I didn&#8217;t find options in documentation.<\/p>\n<p>Thank you<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have similar code: $(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 = &#8216;SUM SEVERAL PREVIOUS CELLS&#8217;; } container = document.getElementById(&#8216;example1&#8217;), settings1 = { data: data, colHeaders: @Html.Raw(ViewBag.TableHeader), cells: function (row, col, prop) { var cellProperties = {}; if (col == 16) { cellProperties.renderer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8018","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=8018"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8018\/revisions"}],"predecessor-version":[{"id":8692,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8018\/revisions\/8692"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=8018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=8018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=8018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}