Hi al. I use handsontable for my app (slalary manage).
I have a problem when edited a cell value. After change value of cell hotElement.setDataAtCell(changes[index][0], col_total, json.total);
, I want use console.log(hotElement.getDataAtCell(0, 9))
get new value cell edited, but is alway return old value.
Thank you!
afterChange: function (changes, source) {
if (source === 'loadData' || source === 'populateFromArray' || changes[0][1] === 'total' || changes[0][1] === 'received' || changes[0][1] === 'holiday_salary') {
return;
}
// khi thêm cột cần điều chỉnh lại chỉ số cột
var col_total = 9; // chỉ số cột tổng lương
var col_received = 12; // chỉ số cột thực nhận
var col_holiday_salary = 6; // chỉ số cột lương ngày nghỉ, lễ
$.each(changes, function(index){
var rowThatHasBeenChanged = changes[index][0],
columnThatHasBeenChanged = changes[index][1];
var sourceRow = hotElement.getSourceDataAtRow(rowThatHasBeenChanged);
$.ajax({
url : script_name + '?' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=salary-content&save_change=1&month=' + $('#current-month').val() + '&nocache=' + new Date().getTime(),
type : "POST",
data : {
save_change: 1,
data : sourceRow
},
success : function(json) {
hotElement.setDataAtCell(changes[index][0], col_total, json.total);
hotElement.setDataAtCell(changes[index][0], col_received, json.received);
hotElement.setDataAtCell(changes[index][0], col_holiday_salary, json.holiday_salary);
}
});
});
hotElement.render();
console.log(hotElement.getDataAtCell(0, 9))
}