Handsontable : how to change cell value in render function

Muflix

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

ZekeDroid

I think I understand what you want to do and here is a simple solution:

From inside the custom renderer, you can call:

instance.getDataAtCell(row, col);

This will give you the data (value) of the cell at row,col. Hope that helps :)

Also, to access the value at the current td, you just use the value variable :P Look at the function definition. You are literally passing it in and is available to you.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to load data only on few columns in handsontable on change in the value of a dropdown in a cell?

From Dev

VBA : How to change the cell's value in a function?

From Dev

handsontable's subproject rulejs: how to get the calculated value of a formula cell?

From Dev

handsontable's subproject rulejs: how to get the calculated value of a formula cell?

From Dev

Handsontable - hide specific row ( by cell value)

From Dev

Handsontable change cell color with respect to the next cell of next column

From Dev

handsontable how to set cell to invalid manually

From Dev

How to add per-cell placeholders to a handsontable?

From Dev

How to Change Conditional Formatting of a Cell Based on a Change in the Cell Value

From Dev

How to change value of one cell onchange of other cell value in DataGridview

From Dev

How to change cell value repeatedly by entering the value in other cell or sheet?

From Dev

How to change the activation function in LSTM cell in Tensorflow

From Dev

datatables: how to change the value of a cell on spacebar?

From Dev

How to change a cell's value in dataframe with pySpark?

From Dev

How to change a formula according to cell value in excel?

From Dev

How to change specific jQuery dataTables cell value

From Dev

How to change a cell value periodically in libreoffice calc?

From Dev

How to change DataGrid cell background color based on cell value

From Dev

How change cell table color in php based on cell value?

From Dev

How to change datagrid cell value when user leaves cell

From Dev

How change cell table color in php based on cell value?

From Dev

DATA Table ... How to change the Color of cell as per the Cell Value Of Table

From Dev

How to change background color of cell based on other cell value by VBA

From Dev

How to change the handsontable context menu language

From Dev

How do I use a function to insert a cell value into another cell?

From Dev

How to change value inside function

From Dev

How do I add a custom Button inside a cell in handsontable?

From Dev

Access cell alignment in Handsontable

From Dev

Update particular cell in Handsontable

Related Related

  1. 1

    How to load data only on few columns in handsontable on change in the value of a dropdown in a cell?

  2. 2

    VBA : How to change the cell's value in a function?

  3. 3

    handsontable's subproject rulejs: how to get the calculated value of a formula cell?

  4. 4

    handsontable's subproject rulejs: how to get the calculated value of a formula cell?

  5. 5

    Handsontable - hide specific row ( by cell value)

  6. 6

    Handsontable change cell color with respect to the next cell of next column

  7. 7

    handsontable how to set cell to invalid manually

  8. 8

    How to add per-cell placeholders to a handsontable?

  9. 9

    How to Change Conditional Formatting of a Cell Based on a Change in the Cell Value

  10. 10

    How to change value of one cell onchange of other cell value in DataGridview

  11. 11

    How to change cell value repeatedly by entering the value in other cell or sheet?

  12. 12

    How to change the activation function in LSTM cell in Tensorflow

  13. 13

    datatables: how to change the value of a cell on spacebar?

  14. 14

    How to change a cell's value in dataframe with pySpark?

  15. 15

    How to change a formula according to cell value in excel?

  16. 16

    How to change specific jQuery dataTables cell value

  17. 17

    How to change a cell value periodically in libreoffice calc?

  18. 18

    How to change DataGrid cell background color based on cell value

  19. 19

    How change cell table color in php based on cell value?

  20. 20

    How to change datagrid cell value when user leaves cell

  21. 21

    How change cell table color in php based on cell value?

  22. 22

    DATA Table ... How to change the Color of cell as per the Cell Value Of Table

  23. 23

    How to change background color of cell based on other cell value by VBA

  24. 24

    How to change the handsontable context menu language

  25. 25

    How do I use a function to insert a cell value into another cell?

  26. 26

    How to change value inside function

  27. 27

    How do I add a custom Button inside a cell in handsontable?

  28. 28

    Access cell alignment in Handsontable

  29. 29

    Update particular cell in Handsontable

HotTag

Archive