contributte / contributte/datagrid

Dibi setSortableCallback multisort called only for one sorted col

Open
#774 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.