sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Office fabric React- TextField or any control

Open jayeshvg opened this issue 8 years ago • 3 comments

Why is it not possible to refer to a control(Eg., TextField) using this in it's events? What are the alternatives.

Category

  • [x ] Question
  • [ ] Typo
  • [ ] Bug
  • [ ] Additional article idea

Example: <TextField value='Testing events' autoAdjustHeight resizable={ false } title='Testing events' maxLength={150} onFocus={(newValue) => { this.multiline = true; //Here, this refers to the component where TextField is place and //not the TextField itself } } />

Expected or Desired Behavior

This within control events, should refer to the current control and not the component where control/component is placed

Observed Behavior

This within control events, refers to the containing control/component where current control/component is placed

Steps to Reproduce

Submission Guidelines

Thanks for your contribution! Sharing is caring.

jayeshvg avatar Apr 17 '18 10:04 jayeshvg

Sorry for not responding, if you are using => notation, "this" points to your current class, not the TextField component.

patmill avatar Sep 07 '21 19:09 patmill

Thanks :)

jayeshvg avatar Sep 08 '21 15:09 jayeshvg

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

ghost avatar Sep 15 '21 18:09 ghost