gregnb / mui-datatables

Datatables for React using Material-UI
MIT License
2.71k stars 934 forks source link

onRowClick and expandableRows not working #540

Closed ahmetsezen closed 5 years ago

ahmetsezen commented 5 years ago

i couldn't use onRowClick and expandable rows. code example :

class RaporTable extends React.Component {
  state = {
    columns: [
      {
        name: 'İşlem Tarihi',
        options: {
          filter: true
        }
      },
      {
        name: 'Adı Soyadı',
        options: {
          filter: true,
        }
      },
      {
        name: 'Road',
        options: {
          filter: true,
        }
      },
      {
        name: 'Miktar',
        options: {
          filter: true,

        }
      },
    ],
    data: [
      ['22/11/2018', 'Business Analyst', 100, 123],
      ['23/12/2018', 'Business Consultant', 2000, 333],
      ['24/11/2018', 'Attorney', 5000, 445],
      ['25/11/2018', 'Business Analyst', 500, 675],
      ['26/11/2018', 'Business Consultant', 7500, 789],
      ['27/11/2018', 'Business Management Analyst', 9400, 562],
      ['28/11/2018', 'Agency Legal Counsel', 210, 953],
      ['29/11/2018', 'Commercial Specialist', 650, 369],

    ]
  }

  render() {
    const { columns, data } = this.state;
    const { classes } = this.props;
    const options = {
      filterType: "dropdown",
      responsive: "stacked",
      filter: false,
      download: false,
      print: false,
      selectableRows: true,
      search: false,
      onRowClick: (row,index)=>{
        alert(row)

      }
    };
    return (
      <div className={classes.table}>
        <MUIDataTable
          title="Rapor"
          data={data}
          columns={columns}
          options={options}

        />
      </div>
    );
  }
}

RaporTable.propTypes = {
  classes: PropTypes.object.isRequired
};

export default withStyles(styles)(RaporTable);
Tech Version
Material-UI "@material-ui/core": "^3.9.0",
MUI-datatables "mui-datatables": "^2.0.0-beta-1",
React "react": "^16.6.0",
browser Chrome
etc
wdh2100 commented 5 years ago

https://codesandbox.io/s/my73nr7q69?fontsize=14

https://stackoverflow.com/questions/31079081/programmatically-navigate-using-react-router

https://github.com/gregnb/mui-datatables/issues/456

:D

gabrielliwerant commented 5 years ago

Closing, as this is a duplicate of https://github.com/gregnb/mui-datatables/issues/553. Also, I believe this functionality is now working, but if not, you can continue in the other issue thread.