How do I make handsontable invalidate data for a pulldown?

Tags: #<Tag:0x00007efc6d2f5768>

I am loading data from a database, and in some cases, the data I load into a HOT will NOT be in the list for a dropdown cell. In this case, I want HOT to automatically highlight it in red as invalid once I set the data, so the user knows to go to the cell and fix it. How can I do this?

At the moment, the data displays as ‘valid’; if i then go to the cell, and hit the enter key (i.e. don’t change the data), it turns red, as expected. I’d like it to turn red automatically when I set the data model value.

I tried validateCells() followed by a render() but that didn’t work. Any ideas?

Hi @fisher23 can you provide a demo illustrating the process of injecting data?

Hi, @fisher23 do you try calling validateCells in this way?

hot.validateCells(function() {
    hot.render();
})
1 Like

@fisher23 relied:

'Continuing the discussion from How do I make handsontable invalidate data for a pulldown?:

Sorry, took me a bit to get back to this problem. I tried your suggestion:

            hot.validateCells(function() {
                hot.render();
            });

But, when I do this (which is immediately after a loadData() command that adds a column, the column (about 100 rows worth) goes from being added instantly to taking about 15-20 seconds to render. During that time Chrome is using about 20% CPU. When I put a console log in there, I can see the callback is being called 444 times. Why would this cause that problem? How do I validate the loaded cells properly?

John’

Any thoughts on this problem? I did a Chrome CPU profile while it was running, and here’s where it was using most of the time:

Hi @fisher23, I’ve created related issue on GitHub. You can track changes here https://github.com/handsontable/handsontable/issues/3276.