imballinst / react-bs-datatable

Bootstrap datatable without jQuery. Features include: filter, sort, pagination, checkbox, and control customization.
https://imballinst.github.io/react-bs-datatable
MIT License
60 stars 20 forks source link

Default sorted field #160

Closed devMagno closed 1 year ago

devMagno commented 1 year ago

Hi there! I have a table where all fields are sortable, but I need to define which field is sorted by default, how can I do this?

The image below is my table and I really need it to be sorted by the vendas field without changing the order of the columns, can someone help me? Thanks in advance!

image

devMagno commented 1 year ago

Oh, nvm, just found out! Leaving it here in case it helps anyone:

<DatatableWrapper
   sortProps={{
    initialState: {
      order: "desc",
      prop: "vendas",
    },
  }}
></DatatableWrapper>