Skip to content

Instantly share code, notes, and snippets.

View AllenFang's full-sized avatar
🇹🇼

allen AllenFang

🇹🇼
View GitHub Profile
class DefaultCustomShowSelectButtonTable extends React.Component {
handleShowSelectButtonClick = (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 ShowSelectedOnlyButton click event');
onClick();
}
createCustomShowSelectButton = (onClick, showSelected) => {
class FullyCustomInsertButtonTable extends React.Component {
createCustomDeleteButton = (onBtnClick) => {
return (
<button style={ { color: 'red' } } onClick={ onBtnClick }>Delete it!!!</button>
);
}
render() {
const options = {
class DefaultCustomDeleteButtonTable extends React.Component {
handleDeleteButtonClick = (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 DeleteButton click event');
onClick();
}
createCustomDeleteButton = (onClick) => {
class FullyCustomInsertButtonTable extends React.Component {
createCustomInsertButton = (openModal) => {
return (
<button style={ { color: 'red' } } onClick={ openModal }>Add rows</button>
);
}
render() {
const options = {
class DefaultCustomInsertButtonTable extends React.Component {
handleInsertButtonClick = (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 InserButton click event');
onClick();
}
createCustomInsertButton = (onClick) => {
class CustomInsertModal extends React.Component {
handleSaveBtnClick = () => {
const { columns, onSave } = this.props;
const newRow = {};
columns.forEach((column, i) => {
newRow[column.field] = this.refs[column.field].value;
}, this);
// You should call onSave function and give the new row
onSave(newRow);
class MyCustomBody extends React.Component {
getFieldValue() {
const newRow = {};
this.props.columns.forEach((column, i) => {
newRow[column.field] = this.refs[column.field].value;
}, this);
return newRow;
}
class FullyCustomInsertModalHeaderTable extends React.Component {
createCustomModalHeader(onClose, onSave) {
const headerStyle = {
fontWeight: 'bold',
fontSize: 'large',
textAlign: 'center',
backgroundColor: '#eeeeee'
};
return (