Material-table: Any way to hide editable fields like onRowAdd row in editable

Created on 27 May 2019  路  3Comments  路  Source: mbrn/material-table

I am planning to pass a props showAdd so that I have an option to make it Add option available only when this props is true.

help wanted

Most helpful comment

If you want to add button with a condition:

onRowAdd: condition ? newData =>
            new Promise((resolve, reject) => {
                setTimeout(() => {
                    {
                        /* const data = this.state.data;
                        data.push(newData);
                        this.setState({ data }, () => resolve()); */
                    }
                    resolve();
                }, 1000);
            }) : null,

All 3 comments

You can use editComponent feature to customize editable field.

Look at 3rd example: https://material-table.com/#/docs/features/editable

If you want to add button with a condition:

onRowAdd: condition ? newData =>
            new Promise((resolve, reject) => {
                setTimeout(() => {
                    {
                        /* const data = this.state.data;
                        data.push(newData);
                        this.setState({ data }, () => resolve()); */
                    }
                    resolve();
                }, 1000);
            }) : null,

@mbrn Thanks that worked

Was this page helpful?
0 / 5 - 0 ratings

Related issues

behrouz-s picture behrouz-s  路  3Comments

Likurg2010 picture Likurg2010  路  3Comments

lazeebee picture lazeebee  路  3Comments

KKrisu picture KKrisu  路  3Comments

bohrsty picture bohrsty  路  3Comments