Skip to content
This repository was archived by the owner on Aug 19, 2024. It is now read-only.
This repository was archived by the owner on Aug 19, 2024. It is now read-only.

How to sort by joined data #17

@dfeinzeig

Description

@dfeinzeig

If I have users and addresses and i'm creating a table of addresses, i want to also show user name and sort by it, not just by address.user_id. how can i do this?

    table = DataTable(request.args, Address, db.session.query(Address).join(User),
        [("address_line_1"),
        ("address_line_2"),
        ("zip",),
        ("user", "user_id", lambda i: i.name),  <-- this shows name in the table, but sorts by id i think
        ("user", "user.name"),  <-- this does not work at all
    ])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions