Autocomplete validation

Tags: #<Tag:0x00007f8b2b029ed8> #<Tag:0x00007f8b2b029d98>

Hi there HoT team,

I have this scenario wherein I have 2 dropdowns dependent on each other. The first dropdown is the one decides the options for the second dropdown.

I’m using setCellMeta(row, col, 'source', options) to be able to update the second dropdown.

Is there a way I can revalidate the second dropdown after the source is being set?

Thank you

Hi @r.evangelio

Thank you for contacting us. Did you try to use validateCells method after updating the source in a second dropdown? I don’t know your full implementation, but it looks like it should be a right solution in your case.

validateCells go through all the cells unfortunately. Is there a way to just validate that specific dropdown that has been changed?

There’s an option to validate only one cell or the whole column:

Hmm but where can I run this method?

I was updating the dropdown source under afterBeginEditing of the dropdown. It there a hook I can use to watch for the changes of the cell meta and there I can run the validation function?

You can use afterChange hook to listen for changes in particular cell and run validation in there.

@adrian.szymanski I don’t think afterChange is getting fired after setCellMeta of a specific cell. What I want to achieve is to validate the cell where set the new dropdown source and not the first dropdown.

Hi @r.evangelio

I’m sorry, you are right. I checked and instead you can use afterSetCellMeta hook to revalidate the dropdown. Here’s an example:

https://jsfiddle.net/aszymanski/rzfc8v5n/

1 Like

Alright this works. Thank you @adrian.szymanski

Great to hear that :slight_smile: I’m closing this topic.