Skip to content

Add default_sort parameter to mo.ui.table #3860

@sarah-utilityapi

Description

@sarah-utilityapi

Description

I am hoping to be able to write the following code that would mean that a ui.table gets initially rendered with a sorted column.

mo.ui.table(data, default_sort='Title')

where 'Title' is the column name name of the.

By default it would be ascending.

We would need a mechanism to specify descending. Possible options

ascending=False  # like pandas
default_sort='-Title'  # like django
default_sort='ASC:Title' or default_sort='DESC:Title' 

If a user then subsequently sorts on a different column the default sort would be lost.

Suggested solution

I've sketched out an API above. I don't know about the under-the-hood implementation.

Alternative

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions