4

Is it possible to remove sorting from some columns devextreme-reactive react grid?

I am using the following grids: https://devexpress.github.io/devextreme-reactive/react/grid/docs/guides/sorting/

You can try code over here: https://codesandbox.io/s/1ir3k

import React, { useState } from 'react';
import Paper from '@material-ui/core/Paper';
import {
  SortingState,
  IntegratedSorting,
} from '@devexpress/dx-react-grid';
import {
  Grid,
  Table,
  TableHeaderRow,
} from '@devexpress/dx-react-grid-material-ui';


import { generateRows } from '../../../demo-data/generator';

export default () => {
  const [columns] = useState([
    { name: 'name', title: 'Name' },
    { name: 'gender', title: 'Gender' },
    { name: 'city', title: 'City' },
    { name: 'car', title: 'Car' },
  ]);
  const [rows] = useState(generateRows({ length: 8 }));
  const [defaultSorting] = useState([
    { columnName: 'gender', direction: 'desc' },
  ]);
  const [sortingStateColumnExtensions] = useState([
    { columnName: 'gender', sortingEnabled: false },
  ]);

  return (
    <Paper>
      <Grid
        rows={rows}
        columns={columns}
      >
        <SortingState
          defaultSorting={defaultSorting}
          columnExtensions={sortingStateColumnExtensions}
        />
        <IntegratedSorting />
        <Table />
        <TableHeaderRow showSortingControls />
      </Grid>
    </Paper>
  );
};

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.