javascript - Reactjs - How do I check to see if a user clicks a textbox within a table row? -
i have table rows each row containing textbox numbers can typed in.
in addition, if user clicks table row, expands show sub groups within row.
<tr classname={this.props.showdetails === true ? 'expanded' : 'collapsed'} onclick={() => this.props.showorhidedetails(someargument)}> <td classname='col-md-2'> <glyphicon classname="arrow" glyph={this.props.showdetails === true ? 'triangle-bottom' : 'triangle-right'} /> <input classname="" type="text" placeholder="type text"/> </td> ... my problem if user clicks within textbox in order type stuff, showorhidedetails triggered expanding row , showing details. now, of course makes sense based on way code structured how expand row if haven't clicked textbox part? haven't quite figured out yet.
any appreciated.
you prevent event propagating parent element. prevent showorhidedetails firing.
<input onclick={ e => { e.stoppropagation();} } classname="" type="text" placeholder="type text"/>
Comments
Post a Comment