filling a select element after rendering the widget

10-10-2021 05:28 AM
New Contributor


I have some problem with filling Select Element after rendering.

When I store data get  from a layer'field into an array and I want to fill in the Select element with array's item.

but in widget life cycle there is not any place between render and destroy that I put my code:

  => {
                  const opt = document.createElement("option");
                  opt.value = item;
                  opt.innerHTML = item;                   
                  const selectElement = document.getElementById("modeSelect");
                   selectElement .appendChild(opt);                
I am not sure but I think in react's life cycle there is componentDidMount that do this job, I am looking
to find something like this in widget lifecycle.
I also tried to fill in Select element during rendering but I encounter with a error that means
Select element is not ready so I decided to find a way to do that after rendering.
0 Kudos
0 Replies