[v2] Smart Select value change does not trigger update

In version 2 of framework7, the smart select does not correctly show the selection after it was changed programmatically

How to reproduce?
I used the demo https://framework7.io/docs-demos/smart-select.html?theme=md
Open the developer bar and enter the following commands:

  • Dom7(‘select[name=fruits]’).val(‘melon’)
  • Dom7(‘select[name=fruits]’).change()

This changes the value of the first select element and explicit triggers the change event.

What is the expected behaviour?
The smart select should now correctly display ‘Pineapple’ in the item-after element.
In v1 of framework7 this did indeed work as expected,

Yeah, there is an issue with this thing in v2 currently that will be fixed in next update. As a workaround, you may use the following:

  • call app.smartSelect.get(...) to the SmartSelect instance
  • call instance’s .setValue() method
var ss = app.smartSelect.get('.some-smart-select');
ss.setValue();
2 Likes

Thank you!
I am waiting for the new version then. I found another bug, that might be caused by the same issue.

When you use the ‘fillFormWithLeadData()’ function to load a form or cause any other update on the select field, the smart select adds the ‘input-with-value’ class to the select, even though the selection is empty

$$('.some_smart_select').val('some_val').change(); 
2 Likes

has it been fixed? I’ve got the same problem but with 4.0.0