いくつかのonChange
イベントを処理し、うまく機能する関数があります。その関数は別の関数を呼び出してセルの内容をチェックし、何か問題がある場合はセルの色を変更する必要があります。
function Check(x, y)
{
var content = $editorTableContainer.handsontable('getDataAtCell', y, x);
var split = content.split(' ');
$.each(split, function (key, value) {
$.get('check.php?word=' + value, function (data) {
//blank if no error otherwise it returns an array of suggestions (only need to check if there is an error)
if (data) {
alert("test");
var meta = $editorTableContainer.handsontable('getCellMeta', y, x);
meta.renderer = ErrorRenderer;
}
});
});
return;
}
そして、ここに私の単純な ErrorRenderer があります:
function ErrorRenderer(instance, td, row, col, prop, value, cellProperties)
{
Handsontable.TextCell.renderer.apply(this, arguments);
console.log(row);
td.style.fontWeight = 'bold';
td.style.color = 'green';
td.style.background = '#CEC';
}
アラートがトリガーされても、ErrorRenderer が呼び出されることはありません。
ありがとうございました