contributte / contributte/datagrid

Is there a possibility of disabling default sorting?

Open
#731 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

T: Question
Dominant language
PHP
Stars
296
Forks
215
PR merge metrics
No merged PRs in 30d

Description

As a data source, I have wrapped SQL with necessary ordering. Datagrid generates this SQL:

SELECT * FROM ( select * from user order by name) val ORDER BY "id" ASC LIMIT 15

So, I want to disable default sorting by primary key. Is it possible?

p.s. you have a typo in documentation here:
https://ublaboo.org/datagrid/column

$grid->setDefaultSort('id' => 'DESC', FALSE);

should be:
$grid->setDefaultSort(['id' => 'DESC'], FALSE);

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 reviewing the reported generated SQL and the setDefaultSort example at https://ublaboo.org/datagrid/column. Determine how default primary-key sorting can be disabled without changing the wrapped query, and correct the documentation typo; done means both the sorting behavior and the documented example are fixed.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
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.