Hook: afterSetDataAtCell

afterSetDataAtCell does not trigger after applying change at cell.
It looks like it triggered ‘before’ setting data at cell.

below href is demo for this issue. it loges its change and cell data by called getData.
after cell changed, the logged data from getData do not have changes.

https://jsfiddle.net/7anwv0yb/

Hi @dldms800

you had a ) missing in the code. Here’s an updated demo https://jsfiddle.net/handsoncode/v5nc0qcc/

The afterSetDataAtCell is called for the user change and after programmatically called

setTimeout( function(){
	hot.setDataAtCell(2,2, 'sample')
}, 1000)

but it doesn’t work.
At first, [0, currency, euro, foobar] was change, but It was not applied on data.
After Second change, second change wasn’t applied but only first change was applied. I think the hook called before the handsontable actually changes its cell.

Sorry @dldms800 but I won’t help without an example. It works in my demo

your demo also doesn’t work. at line three, the change GBP to sample not applyied.

this is the change you applyied.

[[2,"currencyCode","GBP","sample"]]

this is your output in afterSetDataAtCell

[3,"GBP","GBP","Pound Sterling",0.6396,"GBP / USD","08/19/2015",0]
[[1,"EUR","EUR","Euro",0.9033,"EUR / USD","08/19/2015",0.0026],[2,"JPY","JPY","Japanese Yen",124.387,"JPY / USD","08/19/2015",0.0001],[3,"GBP","GBP","Pound Sterling",0.6396,"GBP / USD","08/19/2015",0],[4,"CHF","CHF","Swiss Franc",0.9775,"CHF / USD","08/19/2015",0.0008],[5,"CAD","CAD","Canadian Dollar",1.3097,"CAD / USD","08/19/2015",-0.0005],[6,"AUD","AUD","Australian Dollar",1.3589,"AUD / USD","08/19/2015",0.002],[7,"NZD","NZD","New Zealand Dollar",1.5218,"NZD / USD","08/19/2015",-0.0036],[8,"SEK","SEK","Swedish Krona",8.528,"SEK / USD","08/19/2015",0.0016],[9,"NOK","NOK","Norwegian Krone",8.2433,"NOK / USD","08/19/2015",0.0008],[10,"BRL","BRL","Brazilian Real",3.4806,"BRL / USD","08/19/2015",-0.0009],[11,"CNY","CNY","Chinese Yuan",6.3961,"CNY / USD","08/19/2015",0.0004],[12,"RUB","RUB","Russian Rouble",65.598,"RUB / USD","08/19/2015",0.0059],[13,"INR","INR","Indian Rupee",65.3724,"INR / USD","08/19/2015",0.0026],[14,"TRY","TRY","New Turkish Lira",2.8689,"TRY / USD","08/19/2015",0.0092],[15,"THB","THB","Thai Baht",35.5029,"THB / USD","08/19/2015",0.0044],[16,"IDR","IDR","Indonesian Rupiah",13.83,"IDR / USD","08/19/2015",-0.0009],[17,"MYR","MYR","Malaysian Ringgit",4.0949,"MYR / USD","08/19/2015",0.001],[18,"MXN","MXN","Mexican New Peso",16.4309,"MXN / USD","08/19/2015",0.0017],[19,"ARS","ARS","Argentinian Peso",9.2534,"ARS / USD","08/19/2015",0.0011],[20,"DKK","DKK","Danish Krone",6.7417,"DKK / USD","08/19/2015",0.0025],[21,"ILS","ILS","Israeli New Sheqel",3.8262,"ILS / USD","08/19/2015",0.0084],[22,"PHP","PHP","Philippine Peso",46.3108,"PHP / USD","08/19/2015",0.0012]]

I think afterSetDataAtCell called before ‘setData’ finished or applied or handsontable has some concurrency problem

Hi @dldms800

you’re right. The callback is fired too quickly. If you add a delay it shows you data from getData https://jsfiddle.net/handsoncode/hjLogcoj/

@dldms800 , @aleksandra_budnik

I believe afterSetDataAtCell() gets called with the proposed changes prior to validation (which can reject the change). [But I may be mistaken: I don’t have a version of Hot with afterSetDataAtCell().] You may find that hook afterValidate() fits your needs better…