Skip to content

Instantly share code, notes, and snippets.

View AllenFang's full-sized avatar
🇹🇼

allen AllenFang

🇹🇼
View GitHub Profile
class CustomButtonGroup extends React.Component {
createCustomButtonGroup = props => {
return (
<ButtonGroup className='my-custom-class' sizeClass='btn-group-md'>
{ props.showSelectedOnlyBtn }
{ props.exportCSVBtn }
{ props.insertBtn }
{ props.deleteBtn }
<button type='button'
class MySearchPanel extends React.Component {
cleanBtnClick = () => {
this.refs.seachInput.value = '';
this.props.search('');
}
seachBanana = () => {
this.refs.seachInput.value = 'banana';
class MySearchPanel extends React.Component {
render() {
return (
<div>
<div className='input-group'>
<span className='input-group-btn'>
<button
className='btn btn-primary'
type='button'>
CustomButton1
class MySearchField extends React.Component {
// It's necessary to implement getValue
getValue() {
return ReactDOM.findDOMNode(this).value;
}
// It's necessary to implement setValue
setValue(value) {
ReactDOM.findDOMNode(this).value = value;
}
class DefaultCustomSearchFieldTable extends React.Component {
createCustomSearchField = (props) => {
return (
<SearchField
className='my-custom-class'
defaultValue={ props.defaultSearch }
placeholder={ props.searchPlaceholder }/>
);
}
class FullyCustomClearButtonTable extends React.Component {
createCustomClearButton = (onClick) => {
return (
<button className='btn btn-warning' onClick={ onClick }>Clean</button>
);
}
render() {
const options = {
class DefaultCustomClearButtonTable extends React.Component {
handleClearButtonClick = (onClick) => {
// Custom your onClick event here,
// it's not necessary to implement this function if you have no any process before onClick
console.log('This is my custom function for ClearSearchButton click event');
onClick();
}
class FullyCustomInsertButtonTable extends React.Component {
createCustomExportCSVButton = (onClick) => {
return (
<button style={ { color: 'red' } } onClick={ onClick }>Custom Export CSV Btn</button>
);
}
render() {
const options = {
class DefaultCustomExportButtonTable extends React.Component {
handleExportCSVButtonClick = (onClick) => {
// Custom your onClick event here,
// it's not necessary to implement this function if you have no any process before onClick
console.log('This is my custom function for ExportCSVButton click event');
onClick();
}
createCustomExportCSVButton = (onClick) => {
class FullyCustomShowSelectButtonTable extends React.Component {
createCustomShowSelectButton = (onClick, showSelected) => {
return (
<button style={ { color: 'red' } } onClick={ onClick }>
{ showSelected ? 'Select Only' : 'All' }
</button>
);
}