Mui-datatables: [QUESTION]: Is there any way to set initial sort/page/filter?

Created on 16 Aug 2019  路  6Comments  路  Source: gregnb/mui-datatables

I didn't find any way, to set initial config in the table, except for the use of custom renderer.
Is there more easy and clear solution ?

| Tech | Version |
|--------------|---------|
| Material-UI | 2.8.1 |
| React | 16.9 |

Most helpful comment

In that case, I think what you're looking for is this (also in column options):

image

Note that only the first column will take a default direction and the rest will be ignored (since multiple columns can't be sorted independently, as they affect each other).

All 6 comments

Look in the Usage second of the docs. It shows a column array you can use that has some of those parameters set (specificaly the "customize columns" part).

@MellowoO I think you are looking for table options and/or column options like these, correct?

(Table options)
Capture_foo1
(Column options)
image
image

If so, have a look through the docs and see if it's missing something you need.

@gabrielliwerant hi!
Yes, you are right
But for example, if i need to specify initial sort column

const columns = [
 {
  name: "name",
  label: "Name",
  options: {
   filter: true,
   sort: true,
  }
 },
 {
  name: "company",
  label: "Company",
  options: {
   filter: true,
   sort: true,
  }
 },]

I want to display "sort arrow" icon on name column by default
Can i do this?

@gabrielliwerant or set any selected by default filters

In that case, I think what you're looking for is this (also in column options):

image

Note that only the first column will take a default direction and the rest will be ignored (since multiple columns can't be sorted independently, as they affect each other).

Thank you)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

demoreno picture demoreno  路  4Comments

JordanKadish picture JordanKadish  路  4Comments

Aankhen picture Aankhen  路  3Comments

ronaiza-cardoso picture ronaiza-cardoso  路  3Comments

T-pirithiviraj picture T-pirithiviraj  路  3Comments