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

Data as array of objects with properties which have a "dot" #909

Open
rubenp9 opened this issue Sep 10, 2019 · 1 comment
Open

Data as array of objects with properties which have a "dot" #909

rubenp9 opened this issue Sep 10, 2019 · 1 comment

Comments

@rubenp9
Copy link

rubenp9 commented Sep 10, 2019

Hello,
I think that there is a bug when you use data as array of object with properties which have a "dot":

render() {
    const { tableData } = this.props;

    let cols = [
      {
        name: '1',
        label: 'ID 1'
      },
      {
        name: '1_1',
        label: 'ID 1_1'
      },
      {
        name: '9.1',
        label: 'ID 9.1'
      }
    ];

    let data = [
      {
        '1': 'it works',
        '1_1': 'it works',
        '9.1': 'it does not work'
      },
      {
        '1': 'it works again',
        '1_1': 'it works again',
        '9.1': 'it does not work yet'
      }
    ];

    return (
      <MUIDataTable data={data} columns={cols} options={this.getOptions()} />
    );
  }

To solve that I have to replace using '9.1'.replace('.', '_') or something similar.

Any suggestions?

Tech Version
Material-UI 3.9.3
MUI-datatables 2.9.0
React 16.8.6
browser Google Chrome Version 76.0.3809.132 (Official Build) (64-bit)
@rubenp9 rubenp9 changed the title Data as array of objectswith properties which have a "dot" Data as array of objects with properties which have a "dot" Sep 10, 2019
@gabrielliwerant
Copy link
Collaborator

@rubenp9 Nice find. Yes, this is an unintended consequence of enabling nested data access through the standard dot notation. I'm open to suggestions about how to work around this. It's a little messy, but we could add an option like enableNestedDataAccess which could be flagged on or off to enabled/disable parsing the dot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants