Skip to content

Sorting data table columns ASC from field name headers #38

@adrianbj

Description

@adrianbj

When clicking field names (in the th row in the data table) you can sort DESC, but the icon, link and title don't change after the reload so there is no way (AFAIK) to sort ASC.

In select.inc.php you can fix this with:

if ($sortable) {
    if(isset($_GET['desc'][0])) {
        echo "<a href='" . h($href) . "' title='" . lang('ascending') . "' class='button light'>", icon_solo("arrow-up"), "</a>";
    }
    else {
        echo "<a href='" . h($href . $desc) . "' title='" . lang('descending') . "' class='button light'>", icon_solo("arrow-down"), "</a>";
    }
}

Now it seems to work as I would expect, but I also feel like there is meant to be the ability to sort by multiple columns with a shift click, but the only ever opens the whole thing in a new tab.

So, this might need more work but hopefully it's a start.

Of course there is the sort form for the multiple field sort, so my hack above probably needs specific logic for each field based on its current sort direction (if already defined in the URL querystring).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementExisting feature could be improved
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions