reactjs - How to call method on react-bootstrap-table element in typescript? -
i think problem i'm having casting "any" bootstraptableref react-bootstrap-table, setting ref, or importing wrong. cannot figure out how enable access method of imported table. saw this htmlinputelement cannot work type bootstraptable. this method want call:
this.refs.table.cleanselected(); // this.refs.table ref bootstraptable in resultstables.tsx i'm referencing way
import select "react-select"; import { bootstraptable, tableheadercolumn } 'react-bootstrap-table'; // import "../../../node_modules/react-bootstrap-table/css/react-bootstrap-table.css"; import { link } "react-router"; import * reactdom 'react-dom'; then below
export class resultstable extends react.component<iresultstableprops, iresultstablestate>{ bootstraptableref: any; ... public render() { ... return ( <bootstraptable data={this.props.lots} keyfield="lotnumber" striped condensed={true} id="searchresultstable" selectrow={selectrow} hover ref={(i) => this.bootstraptableref = i} ...> ... </bootstraptable> ); i want able error method not exist on type reactinstance/element. tried different ways of casting can't casting type recognized either.
clear() { this.refs.bootstraptableref.cleanselected(); } i have tried access these 2 ways without success:
clearselectedrow() { var table = reactdom.finddomnode<bootstraptable>(this.refs.bootstraptableref); table.cleanselected(); var tableref2 = <bootstraptable>document.getelementbyid("searchresultstable"); tableref2.cleanselected(); }
try:
<bootstraptable ref="bootstraptable" /> const table: = this.refs.bootstraptable; table.cleanselected();
Comments
Post a Comment