Skip to content
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

localization: header.action and editable breaks my table #1182

Closed
tms87 opened this issue Oct 12, 2019 · 1 comment
Closed

localization: header.action and editable breaks my table #1182

tms87 opened this issue Oct 12, 2019 · 1 comment
Labels
wontfix This will not be worked on

Comments

@tms87
Copy link

tms87 commented Oct 12, 2019

I'm learning how to use material-table and react, new with both. I'm not sure if its a bug or I'm doing something wrong but boths things works fine separatedly. With localization I was able to correctly rename the Actions column and with editable I was able to correctly edit, add or remove rows (I just copy the example).

When I use both things together i just get a white screen. After inspect with google chrome i found this errors

Uncaught TypeError: Cannot read property 'addTooltip' of undefined
at MaterialTable.getProps (material-table.js:473)
at new MaterialTable (material-table.js:363)
at constructClassInstance (react-dom.development.js:14303)
at updateClassComponent (react-dom.development.js:18355)
at beginWork$1 (react-dom.development.js:20085)
at HTMLUnknownElement.callCallback (react-dom.development.js:363)
at Object.invokeGuardedCallbackDev (react-dom.development.js:412)
at invokeGuardedCallback (react-dom.development.js:465)
at beginWork$$1 (react-dom.development.js:25711)
at performUnitOfWork (react-dom.development.js:24619)
at workLoopSync (react-dom.development.js:24592)
at performSyncWorkOnRoot (react-dom.development.js:24153)
at react-dom.development.js:12313
at unstable_runWithPriority (scheduler.development.js:818)
at runWithPriority$2 (react-dom.development.js:12259)
at flushSyncCallbackQueueImpl (react-dom.development.js:12308)
at flushSyncCallbackQueue (react-dom.development.js:12296)
at discreteUpdates$1 (react-dom.development.js:24334)
at discreteUpdates (react-dom.development.js:1485)
at dispatchDiscreteEvent (react-dom.development.js:5949)

index.js:1375 The above error occurred in the component:
in MaterialTable
in Unknown (created by WithStyles(Component))
in WithStyles(Component) (at UsersTable.js:28)
in UsersTable (at Patients.js:13)
in main (created by ForwardRef(Container))
in ForwardRef(Container) (created by WithStyles(ForwardRef(Container)))
in WithStyles(ForwardRef(Container)) (at Patients.js:10)
in Patients (at Body.js:15)
in main (created by ForwardRef(Container))
in ForwardRef(Container) (created by WithStyles(ForwardRef(Container)))
in WithStyles(ForwardRef(Container)) (at Body.js:12)
in Home (at App.js:12)
in div (at App.js:10)
in App (at src/index.js:7)
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

Uncaught TypeError: Cannot read property 'addTooltip' of undefined
at MaterialTable.getProps (material-table.js:473)
at new MaterialTable (material-table.js:363)
at constructClassInstance (react-dom.development.js:14303)
at updateClassComponent (react-dom.development.js:18355)
at beginWork$1 (react-dom.development.js:20085)
at HTMLUnknownElement.callCallback (react-dom.development.js:363)
at Object.invokeGuardedCallbackDev (react-dom.development.js:412)
at invokeGuardedCallback (react-dom.development.js:465)
at beginWork$$1 (react-dom.development.js:25711)
at performUnitOfWork (react-dom.development.js:24619)
at workLoopSync (react-dom.development.js:24592)
at performSyncWorkOnRoot (react-dom.development.js:24153)
at react-dom.development.js:12313
at unstable_runWithPriority (scheduler.development.js:818)
at runWithPriority$2 (react-dom.development.js:12259)
at flushSyncCallbackQueueImpl (react-dom.development.js:12308)
at flushSyncCallbackQueue (react-dom.development.js:12296)
at discreteUpdates$1 (react-dom.development.js:24334)
at discreteUpdates (react-dom.development.js:1485)
at dispatchDiscreteEvent (react-dom.development.js:5949)

This is my table

<MaterialTable
options={{
search: true
}}
title="Pacientes"
columns={state.columns}
data={state.data}
editable={{
onRowAdd: newData =>
new Promise(resolve => {
setTimeout(() => {
resolve();
const data = [...state.data];
data.push(newData);
setState({ ...state, data });
}, 600);
}),
onRowUpdate: (newData, oldData) =>
new Promise(resolve => {
setTimeout(() => {
resolve();
const data = [...state.data];
data[data.indexOf(oldData)] = newData;
setState({ ...state, data });
}, 600);
}),
onRowDelete: oldData =>
new Promise(resolve => {
setTimeout(() => {
resolve();
const data = [...state.data];
data.splice(data.indexOf(oldData), 1);
setState({ ...state, data });
}, 600);
}),
}}
actions={[
{
icon: 'assignment',
tooltip: 'Actividades',
onClick: (event, rowData) => {
// Do save operation
}
},
]}
components={{
Toolbar: props => (
<div style={{ backgroundColor: '#e8eaf5' }}>
<MTableToolbar {...props} />

),
}}
localization={{
header: {
actions: 'Acciones',
}
}}
/>

mbrn added a commit that referenced this issue Oct 20, 2019
@stale
Copy link

stale bot commented Jun 15, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

@stale stale bot added the wontfix This will not be worked on label Jun 15, 2020
@stale stale bot closed this as completed Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant