Setting Properties within a class method ArcGIS API 4.x

113
0
11-28-2021 08:44 PM
ZachPorteous
New Contributor II

Hello, 

I may be thinking about this all wrong, but I cannot figure out why I cant set a property based on the value of a triggered event within a custom widget class (my event is a date input). 

what am I getting wrong here? I know this is probably a simple solution... but I don't get why it wouldn't be possible to set a value within a class when an html element belongs to that class..? It doesn't make sense for me to move the date selector out of the class... because it is central to the widgets functionality. How do I set that value?

// declared property im trying to change
@property()
ed:String = this.TodayPretty; // setting to another property I have made as default

private _eDateHandler(e:Event) { 
    let target = e.currentTarget as HTMLInputElement;
    console.log(`changed ed to ${target.value}`)
    this.ed = target.value // fails to change the state of the widget
 }

// further down in HTML....

<input 
  type="date" 
  id="ed" 
  name="End Date" 
  onchange={this._eDateHandler}
  value={this.TodayPretty}
></input><br/>

 

0 Kudos
0 Replies