hello,
i am trying add values from column 1 and column 2 and displaying them in column 4 but until i do something in column 4 it wont render the addition of column 1 and column 2. so i am trying to figure out how to re render it
https://codesandbox.io/s/youthful-noyce-8s08q?fontsize=14&hidenavigation=1&theme=dark
Hey @edmrepost33
I do not see any change hook (beforeChange
/ afterChange
) attached and even when I edit all the cells nothing happens. Is that a correct demo?
just add values in green columns first and then add any random value in any cell in red column.
also i am like new in this library so can you help me with ( beforeChange
/ afterChange
) thing?
hey
please check the screenshot to understand how that demo is working…
when i add values in green cells it should re render the value in red cell but its not re rendering until i add some value in red cell column just like i added 0.
Sorry, I see that my last demo hasn’t been saves correctly. Here’s a new demo https://codesandbox.io/s/xenodochial-mclaren-j7myw
I removed columnSummary totally and packed the logic into afterChange
hook. You just need to attach the proper logic for the red cell as I used SUM
(you change line 50
). You also need lines 28
and 32
to set up a numeric
cell type.
thanks… let me check this one with in my project
hey,
the demo you have provided is working fine. thanks
just one more question
if i have multiple red cells where value depends on some other green cells then i have to use switch statement in afterChange or i can use array kinda login in here just like columnSummary?
You can type anything you want. You just need to check if you are blocking setDataAtCell
from going into an infinite loop. You may want to attach source
parameter just to be sure that it won’t crash.
The source
is any string (example myOwnMethod
) that you would use inside the IF
statement that controls the setDataAtCell
run.