peter.nr
peter.nr

Reputation: 1

Backpack for Laravel: Multi column order doesn't work

When I click on column header, it orders the column (and changes the icon).It's ok.

Then I push SHIFT and click on another column header, it changes the icon, but doesn't order the column. This should be multi column function, but doesn't work.

The same case is when I insert this code to setupListOperation method:

$request = $this->crud->getRequest();
if (!$request->has('order')) {
    $request->merge(['order' => [
        ['column' => '0', 'dir' => 'desc',],
        ['column' => '1', 'dir' => 'asc',],
    ]]);
}

It orders only first column from array.

Please, how to repair it? Thanks.

Upvotes: 0

Views: 408

Answers (1)

tabacitu
tabacitu

Reputation: 6193

That is correct - Backpack does not support multi-column ordering at the moment. Behind the scenes that screen use DataTables, which does support multi-column ordering using the Shift key like you said. That means implementing it should be possible by

  • publishing the correct view (in this case I believe it's datatables_logic.blade.php) to make changes to its JS;
  • overwriting the search() method in the CrudController that needs-multi-column-ordering OR creating a different ListOperationTrait that responds with multi-column-ordering;

I think the feature is interesting. If you move the conversation over to Github, by opening an issue, I'll gladly explore the possibility of building the feature for our next version.

Upvotes: 1

Related Questions