This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SortHookTable extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
sortName: undefined, | |
sortOrder: undefined | |
}; | |
this.options = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DisableSortIndicatorTable extends React.Component { | |
constructor(props) { | |
super(props); | |
this.options = { | |
sortIndicator: false // disable sort indicator | |
}; | |
} | |
render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCaret(direction) { | |
if (direction === 'asc') { | |
return ( | |
<span> up</span> | |
); | |
} | |
if (direction === 'desc') { | |
return ( | |
<span> down</span> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function priceFormatter(cell, row) { | |
return `<i class='glyphicon glyphicon-usd'></i> ${cell}`; | |
} | |
class HtmlColumnFormatTable extends React.Component { | |
render() { | |
return ( | |
<BootstrapTable data={ products }> | |
<TableHeaderColumn dataField='id' isKey>Product ID</TableHeaderColumn> | |
<TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveFormatter extends React.Component { | |
render() { | |
return ( | |
<input type='checkbox' checked={ this.props.active }/> | |
); | |
} | |
} | |
function activeFormatter(cell, row) { | |
return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const qualityType = { | |
0: 'good', | |
1: 'bad', | |
2: 'unknown' | |
}; | |
const inStockStatus = { | |
1: 'yes', | |
2: 'no' | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveFormatter extends React.Component { | |
render() { | |
return ( | |
<input type='checkbox' checked={ this.props.active }/> | |
); | |
} | |
} | |
function activeFormatter(cell, row, enumObject, index) { | |
console.log(`The row index: ${index}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TextFilter extends React.Component { | |
render() { | |
return ( | |
<BootstrapTable data={ products }> | |
<TableHeaderColumn dataField='id' isKey>Product ID</TableHeaderColumn> | |
<TableHeaderColumn dataField='name' filter={ { type: 'TextFilter', delay: 1000 } }>Product Name</TableHeaderColumn> | |
<TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn> | |
</BootstrapTable> | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TextFilterWithDefaultValue extends React.Component { | |
render() { | |
return ( | |
<BootstrapTable data={ products }> | |
<TableHeaderColumn dataField='id' isKey>Product ID</TableHeaderColumn> | |
<TableHeaderColumn dataField='name' filter={ { type: 'TextFilter', defaultValue: '0' } }>Product Name</TableHeaderColumn> | |
<TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn> | |
</BootstrapTable> | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProgrammaticallyTextFilter extends React.Component { | |
/* There're two way that you can filter data */ | |
handleBtnClick = () => { | |
this.refs.nameCol.applyFilter('Item name 3'); | |
} | |
/* This is also work for filtering */ | |
handleBtnClick1 = () => { | |
this.refs.table.handleFilterData({ name: 'Item name 3' }); |