jbetancur / react-data-table-component

A responsive table library with built-in sorting, pagination, selection, expandable rows, and customizable styling.
https://react-data-table-component.netlify.app
Apache License 2.0
2.04k stars 411 forks source link

reorder property does not apply to cells #1167

Open Christophe-Sibille opened 12 months ago

Christophe-Sibille commented 12 months ago

Issue Check list

Sample of the code

'use client'; import Image from 'next/image' import styles from './page.module.css' import DataTable from 'react-data-table-component'

export default function Home() {

const columns=[ { name:'Title', reorder:false, sortable:false, selectableRows:false, selector:row => row.title }, { name:'Description', reorder:false, sortable:false, selectableRows:false, selector:row => row.description } ];

const data=[ { id:1, title:'Title 1', description: 'Description 1' }, { id:2, title:'Title 2', description: 'Description 2' } ];

return ( <DataTable columns={columns} data={data} onColumnOrderChange={cols => console.log(cols)}

) }

Describe the bug

I would like to disable the reorder feature on dataTable component. So i try to use the reorder property on all the columns available inside the dataTable.

When i clicked on the header of the column the property is correctly applied but I'm able to reorder the cells themselves. So the property does no apply to the cells.

To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Code Sandbox, Screenshots, or Relevant Code

Please include a codesandbox to help expedite troublshooting.

https://codesandbox.io/embed/react-data-table-sandbox-ccyuu

Otherwise, add screenshots and/or complete sample code to help explain your problem.

Versions (please complete the following information)

clemich commented 9 months ago

Same request here. I didn't found any smart solution. Help/support is welcome