gregnb / gregnb/mui-datatables

Can't filter objects

Open
#831 7 comments 4 reactions 0 assignees View on GitHub
on hold
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

Thanks very much for creating this library.
In my code, one of the columns receives an array of objects. I use customBodyRender to render the data as desired, problem is neither filtering nor searching works on this column because it parses the data as [Object object]. I tried converting the object property I want to display into an array of strings and I can't still filter nor search that column. I tried [this example](https://github.com/gregnb/mui-datatables/blob/master/examples/array-value-columns/index.js) and the app crashes with the error "Objects can't be React children...".

## Expected Behavior
Whether I pass an object or an array of strings, I should be able to filter and search that column.

## Current Behavior
Dropdown filter only shows [Object object] or blank.

## Steps to Reproduce (for bugs)
My data structure looks like this:
```
schools: [
{name: Ridgemont High, id: 1},
{name: Newport High, id: 2}
]
```

The code for the column is:
```
{
name: "schools",
label: "SCHOOL",
options: {
customBodyRender: (value, tableMeta) => {
return (value.map(school => {
return

{school.name}


}))
}
}
}
```

## Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI | 4.3.0 |
| MUI-datatables | 2.6.4 |
| React | 16.8.0 |
| browser | Firefox |
| etc | |

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.