reactjs - How can I clear row selection of a materialui table programatically? -


i materialui table render list of items this:

    <table selectable={true} onrowselection={(index) => this.onrowselection(index)} classname="searchable-table">         <tableheader adjustforcheckbox={false} displayselectall={false} style={style}>             <tablerow style={style}>                 <tableheadercolumn>                     <textfield                         hinttext="search"                         onchange={(e) => this.onsearch(e)}                         fullwidth={false} />                 </tableheadercolumn>             </tablerow>         </tableheader>         <tablebody displayrowcheckbox={false} deselectonclickaway={true}>             {this.renderrows(this.state.data)}         </tablebody>     </table> 

when click on row, onrowselection gets triggered expected, , row gets selected (highlighted). if want fire onrowselection again, have click on selected row twice. 1 deselect , click fire onrowselection again.

enter image description here

how can make doesn't selected , onrowselected gets fired on every click, without needing deselect row first?

if don't want selected think onrowselection should never fired , selectable should false. maybe try oncellclick.

   <table selectable={false} oncellclick={(row, column, event) => this.oncellclick(row, column, event)} classname="searchable-table">         <tableheader adjustforcheckbox={false} displayselectall={false} style={style}>             <tablerow style={style}>                 <tableheadercolumn>                     <textfield                         hinttext="search"                         onchange={(e) => this.onsearch(e)}                         fullwidth={false} />                 </tableheadercolumn>             </tablerow>         </tableheader>         <tablebody displayrowcheckbox={false} deselectonclickaway={true}>             {this.renderrows(this.state.data)}         </tablebody>     </table> 

where row index should first parameter of handler function (i renamed oncellclick).


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -