-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning: Failed prop type: Invalid prop actions[0]
supplied to MaterialTable
.
#127
Comments
Hi @halvardssm , I could not reproduce case. Which version of material-table do you use? |
I have that error too, first (but not sure) in version 1.6 and definitely in 1.7 and 1.8... my code hasn't changed since 1.6 (except localization and icons) and looks like this: render() {
// configure columns
var columns = [
{
title: this.props.t('clubs.number'),
field: 'number',
type: 'numeric',
},{
title: this.props.t('clubs.name'),
field: 'name',
},{
title: this.props.t('clubs.address'),
field: 'address',
},
];
// configure actions
var actions = [
{
icon: EditIcon,
tooltip: t('clubs.edit'),
onClick: this.handleClickEdit,
iconProps: {
style: {
color: blue[400],
},
},
},{
icon: CopyIcon,
tooltip: t('clubs.copy'),
onClick: this.handleClickCopy,
iconProps: {
style: {
color: blue[400],
},
},
},{
icon: DeleteIcon,
tooltip: t('clubs.delete'),
onClick: this.handleClickDelete,
iconProps: {
style: {
color: red[500],
},
},
},
];
// load data table locales
var localization = localeMaterialTable[this.props.i18n.language](t);
// data table config
var options = {
actionsColumnIndex: -1,
};
// configure icons
var icons = {
Check: Check,
Export: SaveAlt,
Filter: FilterList,
FirstPage: FirstPage,
LastPage: LastPage,
NextPage: ChevronRight,
PreviousPage: ChevronLeft,
Search: Search,
ThirdStateCheck: Remove,
ViewColumn: ViewColumn,
};
return (
<div className={classes.root}>
<MaterialTable
title={t('clubs.clubs')}
data={this.state.clubs}
columns={columns}
options={options}
localization={localization}
actions={actions}
icons={icons}
/>
</div>
);
} I've ignored this error until now, because everything is working afaik... |
@mbrn Thanks for looking into this. I recently updated to 1.8 from 1.2, I am not completely sure but I don't think I had the error in 1.2. |
@bohrsty You should look at the new localization props. It has more details and your current localization may not handle new ones. |
Here is my code in case it helps:
|
Thank you for your support! Let me know if you would like me to make a PR on it :) |
Why not @halvardssm:) You will just change line that i show on previous post. Currently: Will change with: |
Will do then 👍 |
same issues happened
|
Can you upgrade to 1.29.1 please? |
@mbrn |
I have a package material-table: 1.39.0 and react: 16.8.6, app is work but I show mistake i console: Problem in this code: Please help me. |
Try this
|
Thanks, this code is works! |
I am having same error in Material Table using this
and this
Issued solved. If any one get this error you can try this
|
This error shows up in the console. I have tried to remove each singular line inside of the 'actions' but the error only goes away if I remove 'actions' itself or everything inside.
This is my 'actions' code:
actions={[
{
icon: Print,
tooltip: 'Print',
onClick: (event, rowData) => {
this.setState({ rowData })
this.handleClickOpen()
},
}
]}
The text was updated successfully, but these errors were encountered: