3

Everything in Material-Table is working good, but I cant find the props / option to disable Drag and Drop for columns headings. I just need it to stay the same as it is provided in code

This is how my columns and options props look like :

columns={[
  {title: 'Name', field: 'name', defaultSort: 'asc'},
  {title: 'Code', field: 'code'},
  {title: 'Type', field: 'type.value'},
  {title: 'Regions', field: 'regions', sorting: false},
  {title: 'Currency', field: 'currencyCode'},
]},
options={{
  showTitle: false,
  actionsColumnIndex: -1
}}
Vra3
  • 33
  • 1
  • 4

3 Answers3

8

You should set draggable option to false

options={{
  draggable: false,
}}

As a result you wont also be able to use grouping option anymore

Dharman
  • 30,962
  • 25
  • 85
  • 135
Amir Keramat
  • 384
  • 4
  • 10
0

Had the same issue, but setting grouping: false didn't solve my problem.

Instead I set pointerEvents: "none" in the headerStyle for each column. That way the headers won't be interactable/ draggable. Worked like a charm.

Fred
  • 397
  • 2
  • 5
  • 17
  • 1
    Thanks for reply Fred! Anyway there was sorting option which would be blocked by pointerEvents: "none" – Vra3 Nov 21 '19 at 11:03
-2

As written in the docs, you can add grouping false in the options object.

Domino987
  • 8,475
  • 2
  • 15
  • 38
  • Domino, grouping is not the case here. Setting this props to false is still allowing to use Drag and Drop and change order of columns – Vra3 Jul 26 '19 at 11:34
  • I am sorry I misread, That is not yet implemented but about to be [merged](https://github.com/mbrn/material-table/pull/779) with the option: draggable. – Domino987 Jul 26 '19 at 16:26