webix 7: combo getValue return string id instead of integer

Since recent upgrade from webix 6.2 to webix 7.2 we discovered a different behavior of "combo" getValue (maybe concern others suggest related components) when the combo is feeded with {id:2, value:'text'} objects

Until webix 6.4, the combo.getValue() return 2 as number whereas since 7.0 it return "2" as string. From our point of view it's a bug because we feed it with integer-type ids, so we expect the component to return the same type.

There is a workaround ?


  • Here a snippet to demonstrate the behavior: https://snippet.webix.com/evwwegp3

    Try with webix 6.4 and webix 7.0

  • Hi webix team, I think it is an unexpected and undocumented behavior change. Can you have a look ?

  • Hello, @Fabien

    So far we consider it as a feature: during inner processing of options and data in general (in list, datatable, etc.), either numeric or string IDs are processed equally and usually treated as string values, and there are no backwards conversion during retrieving the values.

    In general, this behavior does no harm for most of the known use-cases (and the values can be converted manually if needed), but could you please provide more details on your use-case and why this behavior is critical?

  • Our impacted use case is when the combo is used to filter a datatable. Here is an updated snippet:

  • @Fabien
    try not to use strict comparison ===
    use loose comparison == instead

  • == is equivalent of using .toString() or parseInt(). This is a rather ugly solution.

  • Hello, @Fabien

    Loose comparison is definitely solving the problem perfectly in this and other cases. And given the necessity for uniform processing of IDs/values within Webix, we are not planning any changes in the code regarding this behavior at the moment.

  • Ok, I take not of that. Thanks for you answers.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!