Skip to content

Instantly share code, notes, and snippets.

View AllenFang's full-sized avatar
🇹🇼
I may be slow to respond.

allen AllenFang

🇹🇼
I may be slow to respond.
View GitHub Profile
class ExpandRow extends React.Component {
constructor(props) {
super(props);
}
isExpandableRow(row) {
if (row.id < 3) return true;
else return false;
}
class ExpandRow extends React.Component {
constructor(props) {
super(props);
this.state = {
// Default expanding row
expanding: [ 2 ]
};
}
isExpandableRow() {
class ExpandRow extends React.Component {
constructor(props) {
super(props);
}
isExpandableRow(row) {
if (row.id < 3) return true;
else return false;
}
class ExpandRow extends React.Component {
constructor(props) {
super(props);
}
isExpandableRow(row) {
if (row.id < 2) return true;
else return false;
}
class NavWithExpandTable extends React.Component {
isExpandableRow(row) {
if (row.id < 3) return true;
else return false;
}
expandComponent(row) {
return (
<div>
class EnterToEditWithNavTable extends React.Component {
render() {
const cellEdit = {
mode: 'click',
blurToSave: true
};
const keyBoardNav = {
enterToEdit: true
};
return (
class CellEditWithNavWithoutStyleTable extends React.Component {
customStyle = (cell, row) => {
return {
backgroundColor: 'red'
};
}
render() {
const cellEdit = {
class CellEditWithNavTable extends React.Component {
render() {
const cellEdit = {
mode: 'click',
blurToSave: true
};
return (
<BootstrapTable data={ products } cellEdit={ cellEdit } keyBoardNav>
<TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn>
/*
<code>keyBoardNav</code> accept a bool or object value<br/>
Use <code>keyBoardNav.clickToNav</code> to disable the navigation on clicking cell<br/>
If you disable it, you can still navigate with tab and left/right/up/down
*/
class DisableClickToNavigationTable extends React.Component {
render() {
const selectRow = {
mode: 'checkbox',
clickToSelect: true
class CustomStyleNavTable extends React.Component {
customStyle = (cell, row) => {
return {
backgroundColor: 'red'
};
}
render() {
const keyBoardNav = {