Skip to content

Overloading

Lubomir Andrisek edited this page Jul 11, 2019 · 10 revisions

import FatBoy from 'node_modules/npm-masala/components/FatBoy.jsx'
import React, {Component} from 'react'

export default class MyComponent extends FatBoy {
    constructor(props){
        super(props)
    }
    OnChangeCheckBox(props, state) {
        // modify state on change of checkbox
        return {myId:{myOtherId:{props.id:state}}}
    }
    OnChangeEditor(props, state) {
        // modify state on change of wysiwyg editor
        return {myId:{myOtherId:{props.id:state}}}
    }
    OnChangeText(props, state) {
        // modify state on change of text input
        return {myId:{myOtherId:{props.id:state}}}
    }
    OnChangeSelectBox(props, state) {
        // modify state on change of select box
        return {myId:{myOtherId:{props.id:state}}}
    }
    OnFetch() {
        // modify state on fetch handler with initialization state on componentDidMount
        this.setState({myId:myValue})
    }
    Row(key, state) {
        return <tr key={'row-' + key}>
        <td key={'grid-col-id'}>{state.shopio_products_id}</td>
        <td key={'grid-col-name'}>{state.name}</td>
        <td key={'grid-col-perex'} title={state.perex}>{state.perex ? state.perex.slice(0, 30) + '...' : ''}</td>     <td key={'grid-col-text'} title={state.text}>{state.text ? state.text.slice(0, 30) + '...' : ''}</td>
        <td key={'grid-col-edit'}>{this.Icon({id:key})}</td>
        </tr>
        }
    }

Clone this wiki locally