handsontable / ngHandsontable

Official AngularJS directive for Handsontable
http://handsontable.github.io/ngHandsontable/
MIT License
434 stars 159 forks source link

Unable to update CellMeta (specifially comments) in AfterChange Event #245

Closed caden311 closed 6 years ago

caden311 commented 6 years ago

Any idea if there is a proper way to do this? Because It's not working for me. My code looks like this.

` afterChange: (hotInstance, change: Change) => { if (change.newVal) { const otherVal = (+change.newVal).toString(16).toUpperCase(); const rows = ourHot.countRows(); for (let i = 0; i < rows; i++) { const val = ourHot.getDataAtCell(i, MeterColumns.SERIAL_NUMBER); if (i !== change.row && (val === change.newVal || val === otherVal)) { const settings = ourHot.getCellMeta(change.row, change.col); settings.valid = false; settings.comment = {value: 'Testing adding comments'};

         // this doesnt work either
         // const plugin = ourHot.getPlugin('comments');
         // plugin.setCommentAtCell(i, MeterColumns.SERIAL_NUMBER, 'Testing yo');
     }
   }
 }

} `