[Bug] multicombo with newValues=true return new item id instead of text since 7.3

Hi,
Since webix 7.3,

the multicombo widget with newValues: true option return (with getValue) the raw id of the new item instead of the text representation.
This is an undocumented behavior change. There is a way to restore previous behavior ?

Here a snippet : Code Snippet

Try with webix 7.2. Enter an additional value “myvalue”. Result “2,myvalue”
Try with webix 7.3 and above: Enter an additional value “myvalue”. Result “2,1729607841498”

This is a blocking problem in our webix update process. I hope you’ll be able to fix it soon.

check this workaround
https://snippet.webix.com/imafbomz

Thanks for this workaround !
Sadly I can’t have it works on my app. To be honest I don’t understand how it can works in snippet.

For what I understand:

  1. Webix call add
  2. Webix trigger onBeforeAdd
  3. We catch the event and set new id on item
  4. We call add
  5. We return false => the first add is discarded and original item is not added to the list.
  6. In the same time Webix trigger onBeforeAdd for the second add
  7. We catch the event and select item with new id
  8. The select can’t find the id since we never added it to the list

Here another workaround which is working for me using scheme.$change mechanism to set id before it is added into list

https://snippet.webix.com/3joi4y81

Hello Fabien,

We checked old bug reports regarding multicombo, it was an intentional change in the multicombo logic and the reason why we made such changes is that there was a risk to duplicate id while adding a new value and risk of errors while pasting several values at once (with separators).
In our changelog 7.3.0 we describe this but breaking changes are indeed not obvious. We are sorry that these changes influenced your webix update process. We will add more detailed information in changelog 7.3.0 about breaking changes.
Thank you for providing your solutions.
And one more workaround will be to use changeId .
Please check the example: Code Snippet

Thanks for your answer and for the changeId-based solution.

I can’t find in the documentation, in multicombo newValues, what is the official way to know which items are added.
In case, as in the official snippet, the multicombo is in a form, getValue() returns either a string representing the list of ids or a javascript array of ids (stringResult=false).
How to know which items are new ? How to get the values of new items ?
The problem is more problematic in case the form sends data directly to a backend, since we can’t request the widget anymore.

Shouldn’t the multicombo be able to return a list of objects ( like : [{id:2, value:"AAA"}, {id:42, value:"BBB"}]) so we can check for new values more easily ?

Fabien,

Unfortinately, there is no official way to know which items are added, but you can mark list item as new by adding it some custom property ( e. g. $custom: true) in "onAfterAdd" event listener.
And if you collect data from the form, you can just replace the array of IDs from the multicombo with full objects from the options.

Please take a look at the example: Code Snippet