Reset Dropdown selection without onClick

UPDATE
Solved… It was problem in one of my callback and it cause that dropdown was not ready in time I used “selectedItem”.

DONE

Hallo!

I have dropdown element. It appear on a page with placeholder text.
I make selection by clicking mouse
After I see selected item

QUESTION

Is it possible change selection and reset view without any click
For example - URL param.

I open URL with Param, Read this param and show dropdown with this selected item

Thank You in advance
Sincerely, Mikhail Mazel

You can get the URL’s query params using queryParams() . Then, based on the param, you can populate the Dropdown.

Thank You Yisrael! But my question was not about queryParam - I can’t populate Dropdown on selected item without click.

I mean not “fill” - I mean “select” Item which already in Dropdown items list.

FOR EXAMPLE:
I make selection and save selection in queryparam URL - copy this and mailed to somebody. He or She - paste url with param and page appear with selected dropdown Item…

Select and show item without onClick.
is It possible?

@mazel Of course. You can get the URL’s query params using queryParams() and then show the item based on the query param of the URL.

@yisrael-wix That is my question… I cnn’t find how show Dropdown with this param… $w(#mydropdown).selectidex = “myparam”

But how change appereans in dropdown view with with selected line?
it show placeholder

The selectedIndex API is set with an index number . Instead of the value , you can pass the index in the URL’s query param and then use it to set the dropdown.

Thank You. Everything working. I find deep mistake in one deep function - it cause that dropdown was not ready in time I think That it ready… Try to be very careful with callbacks, but time to time opened some “dead ends”… Like in Old joke
2 rules of programming: 1. Any program contained minimum 1 mistake. 2. If You find mistake - read rule 1

@mazel :beers: