Webix datatable combo editor filter combo options depending on item value

Hi Dear Webix Team,
How can the options in editor combo be filtered depending on an value of selected item??

see Snippet: Code Snippet

This way the filtering in combo works but then the other items loose their value.

Thanks,
Michael

Hi Michael,

By writing into collection you replace the data in column’s collection. The cells continue to reference the items using their IDs, but their values may no longer exist as they were stored in the collection.

The data set as column’s collection will be stored in the DataCollection instance. It has the filter method - it doesn’t actually erase other elements, preserving their values.

Instead of strict equality (===) I would suggest using the regular one (==) in the filter function, as after editing with the select editor, the numeric cell value may change into a string.

Here is an example: Code Snippet

I’ve also added editStop() call to close previous editor, to prevent options from leaking into a new select. The refreshColumns() is not necessary, as just the cell and its editor are already refreshed and there is no need to fully refresh all columns. It also makes sense to unfilter values after the editor closes by using filter() with no arguments.

The select editor seems to not be able to restore the value if its filtered out, this may be an issue and I will pass it to our development team. I’ve included a simple workaround that sets the previous value if the selection is cancelled. This is not reproduced in richselect editors: Code Snippet