# Dash Datatable sorting and filtering flags

**URL:** <https://community.plotly.com/t/dash-datatable-sorting-and-filtering-flags/26374>\
**Category:** Dash Python\
**Created:** [July 25, 2019, 12:53pm UTC](https://community.plotly.com/t/dash-datatable-sorting-and-filtering-flags/26374 "2019-07-25T12:53:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Varlor](https://avatars.discourse-cdn.com/v4/letter/v/d2c977/32.png) [@Varlor](https://community.plotly.com/u/Varlor)\
**Post date:** [July 25, 2019, 12:53pm UTC](https://community.plotly.com/t/dash-datatable-sorting-and-filtering-flags/26374/1 "2019-07-25T12:53:01Z")

</div>

I saw that some attributes of datatable were renamed. There is no sorting and filtering=True anymore, instead there is a sort\_action and filter\_action=‘custom’. Is it true that i have to define now a sorting function in a callback like in this callback example:

```
`@app.callback(
    Output('table-multicol-sorting', "data"),
    [Input('table-multicol-sorting', "page_current"),
     Input('table-multicol-sorting', "page_size"),
     Input('table-multicol-sorting', "sort_by")])
def update_table(page_current, page_size, sort_by):
    print(sort_by)
    if len(sort_by):
        dff = df.sort_values(
            [col['column_id'] for col in sort_by],
            ascending=[
                col['direction'] == 'asc'
                for col in sort_by
            ],
            inplace=False
        )
    else:
        # No sort is applied
        dff = df

    return dff.iloc[
        page_current*page_size:(page_current+ 1)*page_size
    ].to_dict('records')`

```

or can i somehow prevent this and just get a simple standard sorting and fultering mode for my datatable?

---

<div class="post-metadata">

**Author:** ![brad](https://avatars.discourse-cdn.com/v4/letter/b/59ef9b/32.png) [@brad](https://community.plotly.com/u/brad)\
**Post date:** [July 25, 2019, 4:16pm UTC](https://community.plotly.com/t/dash-datatable-sorting-and-filtering-flags/26374/2 "2019-07-25T16:16:32Z")

</div>

You’re correct. If you set `sort_action='custom'` or `filter_action='custom'` then you will need to provide your own sorting implementation.

However, for default behavior you can set the attribute to `'native'` to use the previous behavior (default is `'none'`).

```python
layout = ..,
    dt.DataTable(
            data=[{}], 
            ..
            sort_action='native',
            filter_action='native',
            filter_query='{column}{filter rule} ..',
            page_action='native',
            editable=False,
            ..
    ),
    ...

```

Easiest place to find information about attributes are the docs [https://dash.plot.ly/datatable/reference](https://dash.plot.ly/datatable/reference)

---

<div class="post-metadata">

**Author:** ![Varlor](https://avatars.discourse-cdn.com/v4/letter/v/d2c977/32.png) [@Varlor](https://community.plotly.com/u/Varlor)\
**Post date:** [July 26, 2019, 6:55am UTC](https://community.plotly.com/t/dash-datatable-sorting-and-filtering-flags/26374/3 "2019-07-26T06:55:29Z")

</div>

Works, thank you! 🙂
