jquery - Custom renderer function not working in handsontable plugin -
i have function handles onchange
events , works well. function calls 1 check contents of cell, , if there wrong should change cell color.
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 returns array of suggestions (only need check if there error) if (data) { alert("test"); var meta = $editortablecontainer.handsontable('getcellmeta', y, x); meta.renderer = errorrenderer; } }); }); return; }
and here simple 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'; }
the errorrenderer never called, eventhough alert triggered, idea why?
thank you
if using handsontable, why don't use built in functionality?
have @ hts conditional formatting
also, in version 0.9.5 column option added validator
. details here.
validator (value: mixed, callback: function)
or
validator : regexp object
then using event (details here):
aftervalidate (isvalid: boolean, value: mixed, row: number, prop: string, source: string)
do formatting of cell
also, in example, setting renderer, cell being rendered? need re-render?
Comments
Post a Comment