是的,我这样做的原因和你一样
使用 afterChange 事件...
afterChange: function (changes, source) { AfterChange(changes, source); }
...您可以更改其他单元格的值...
function AfterChange(Changes, Source) {
if (Source === 'loadData') {
return; //don't do anything on load
}
var rowIndex = 0, columnID = 1, oldTextVal = 2, newTextVal = 3, ntv = '', nv = '';
$(Changes).each(function () {
if (this[columnID] === 'RegionID') {
//Make sure nothing else happens when these columns are set through below, to avoid circular references
}
else if (this[columnID] === 'RegionName') {
ntv = this[newTextVal];
//I have a dropdown used for filtering which has the id as value where I get the id from
nv = $('#RegionsFilterDropdown option').filter(function () { return $(this).text() === ntv; }).val();
$container.handsontable('setDataAtCell', this[rowIndex], 12, nv);
}
});
}
我希望这有帮助...