Webix Datatable Clear Combo Editor

Hello all,

I have a simple question, but somehow can not find a way to implement this.

Is there a way to clear the selection of a combo editor in a datatable?

Here is a snippet from our combo editor.

https://snippet.webix.com/775tivu3

Greetings Gorden

2 Likes

Hello @gokap001 ,

By default, the combo allows to set the values from the list. To add the ability to set en empty value, you may add it as an option.
Here is an example: Code Snippet.
We get the options list from the needed column on onAfterEditStart datatable event and add an empty value as an option with an $empty flag to the start.

1 Like

Hello Mariya,

this works fine. But is there another way to clear the selection by deleting it with the keyboard and without adding an empty value to the option list?

1 Like

Hello!

I had to deal with the same thing in our app and for comformity I wanted to have an X to clear the value, like with the view ‘combo’ when setting property ‘clear’ to true.

Basically, I use property ‘template’ of the column to add an ‘X’ on the right, and code the corresponding ‘onClick’ event to remove the value. That way we don’t have to “pollute” the suggestList with an empty value, and we get to clear the value when we need to.

Here’s the snippet (Look for comments ‘// This code was added.’): Code Snippet

Hope it helps!
=o)