Programmatically setting the value of a jimu-ui Select

618
2
Jump to solution
06-27-2022 09:18 AM
Danik-B
New Contributor III

This question is for Experience Builder Dev Edition 1.8.

I'm just starting to learn to develop custom widgets in ExpBuilder and I'm struggling with some concepts.  I've managed to figure out how to change the inner text of some jimu-ui elements programmatically. For example, I can change the inner text of this button <Button>{this.state.buttonLabel}</Button> by calling this.setState({ buttonLabel: 'Start'}).

Is it possible to change the value of a jimu-ui Select programmatically?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

@Danik-B Sure you do it the same way set the value of the Select to a state property.

this.setState({value: x});

<Select value={this.state.value} ...

 

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

@Danik-B Sure you do it the same way set the value of the Select to a state property.

this.setState({value: x});

<Select value={this.state.value} ...

 

0 Kudos
Danik-B
New Contributor III

That's pretty easy!  I think I got confused because the jimu-ui Select is not an html select and I didn't know if it could be controlled the same way. Thanks!

0 Kudos