Strange thing about Smart Select

I am trying to find the value of a smart select but i have this problem :

  • when i am selecting a value in the view which has the values then if i inspect the view i find that the item i’ve selected has the selected entry in it’s option tag

  • when i go back, by clicking the button back, if i inspect the view there my selection has no more the selected entry so i cannot use something like app.smartSelect.get(’#mySmartSelect’).$selectEl.val()

I have checked the Kitchen Sink example and i found that it has the same behavior : whatever fruit you choose the selected value remains apple even if the item-content>item-inner>item-after changes value.
Could you tell me where am i wrong ?

selected attribute doesn’t have much common with what really selected, it is just used to set initial value. So it won’t change. And this code should work, you can check in Kitchen Sink:


Thank you, that was is.
I saw that i have a problem in my code too :
i am setting all the option values using the pageAfterIn event of the page and it seems that turning back to the page (after selecting a value in Smart Select) the pageAfterIn event fires again and i’m setting all the option values again : very stupid error made by myself :expressionless:
Is there a way to avoid it?

pageInit should fit better no? Otherwise just add a flag and on another pageAfterIn don’t set options if already set

Thank you again, as always the simple solutions are the best.
Anyway, this is a great framework, excellent work!

1 Like