gregnb / gregnb/mui-datatables
Column without name throws error
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 906
- PR merge metrics
- No merged PRs in 30d
Description
This may not necessarily be a bug as much as it is lack of functionality (love this library by the way) - but if you provide a column without a name an error is thrown. In my use case I use an unnamed column to provide a button for viewing more details about a row item. Current workaround is to provide empty string to `name` attribute in column:
Error appears to occur here in `transformData`: https://github.com/gregnb/mui-datatables/blob/9c79bedc73dcff72453d0059107a59f6548977fb/src/MUIDataTable.js#L446
## Expected Behavior
Providing an unnamed column for the column options should not throw an error.
## Current Behavior
Providing an unnamed column throws an error. Current workaround is to provide empty string to `name` attribute in column:
```
Uncaught TypeError: Cannot read property 'split' of undefined
at index.js:1
at Array.map ()
at index.js:1
at Array.map ()
at t.e.transformData (index.js:1)
at t.value (index.js:1)
at t.value (index.js:1)
at t.value (index.js:1)
at callComponentWillMount (react-dom.development.js:11424)
at mountClassInstance (react-dom.development.js:11514)
```
## Steps to Reproduce (for bugs)
1. Provide a column object as such in the columns array passed to the table:
```
{
options: {
download: false,
filter: false,
sort: false,
viewColumns: false,
customBodyRender: (value, tableMeta, updateValue) => {
return (
{
this.handleOpenItemDialog(tableMeta.rowData[0]);
}}
>
View
);
}
}
}
```
## Your Environment
React + React on Rails (Ruby on Rails)
| Tech | Version |
|--------------|---------|
| Material-UI | 4.4.3 |
| MUI-datatables | 2.11.1 |
| React | 16.8.6 |
| browser | Chrome Version 76.0.3809.132 (Official Build) (64-bit) |
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.