Skip to content
Discussion options

You must be logged in to vote

Hi @soluzione-software,

To customize the order logic for a column in Backpack, you can use the "orderLogic" method as described in our documentation.

By adding the "orderLogic" method to your column, you can set the orderBy clause of the query as per your requirements. For example, if you want to order the results of your query in descending order based on a column called "created_at", you can add the following code to your column:

$this->addColumn([
    'name' => 'created_at',
    'label' => 'Created At',
    'type' => 'datetime',
    'orderLogic' => function ($query, $column, $direction) {
        $query->orderBy($column, 'desc');
    },
]);

In this code, the "orderLogic" method is ad…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by tabacitu
Comment options

You must be logged in to vote
1 reply
@tabacitu
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants