contributte / contributte/datagrid
Dibi setSortableCallback multisort called only for one sorted col
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 296
- Forks
- 215
- PR merge metrics
- No merged PRs in 30d
Description
Hello
I use setSortableCallback on more columns, but only setSortableCallback was called.
Grid show sort on more columns but, only is present in ORDER BY
$grid->setMultiSortEnabled(true);
$grid->setDefaultSort([
'ROK'=> 'ASC',
'MESIC' => 'ASC',
'IDPODNIK' => 'ASC',
'IDZAVOD' => 'ASC',
'IDLS' => 'ASC',
'IDLU' => 'ASC'
], true);
$grid->addColumnText('IDLS','LS')
->setSortable(true)
->setSortableCallback(function(Fluent $fluent, $sort){
$fluent->orderBy(sprintf ('gls.LS %s', isset($sort['IDLS']) ? $sort['IDLS'] : 'ASC'));
})
$grid->addColumnText('IDLU','LU')
->setSortable(true)
->setSortableCallback(function(Fluent $fluent, $sort){
$fluent->orderBy(sprintf ('glu.LU %s', isset($sort['IDLU']) ? $sort['IDLU'] : 'ASC'));
})
I use datagrid version 5.7.1.
Can you help me please ?
Thanks
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue through setMultiSortEnabled(true), setDefaultSort(), and the two setSortableCallback handlers using datagrid 5.7.1. Trace how multisort values are passed to each callback and how orderBy clauses are assembled; done means all selected columns appear in the generated ORDER BY in the expected order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100