DataTables / DataTables/PHP

Group BY

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

Nobody has claimed this yet.

Dominant language
PHP
Stars
36
Forks
26
PR merge metrics
No merged PRs in 30d

Description

No ficheiro Editor.php, adicionar procurar as linhas

/** @var string Action name allowing for configuration */
private $_actionName = 'action';

e adicionar após

/** @var string */
private $_group_by = '';

Adicionar a função

/**
 * @param string $column
 *
 * @return ($column is null ? string[] : $this) Where condition array.
 */
public function groupBy($column) {

    if ($column === null) {
        return $this->_group_by;
    }

    $this->_group_by = $column;

    return $this;
}

Na função
private function _get($id = null, $http = null)

Procurar a linha $ssp = $this->_ssp_query($query, $http); e adicionar depois da mesma

if($this->_group_by != '')
    $query->group_by($this->_group_by);

if ($id !== null) {
    $query->where($this->pkeyToArray($id, true));
}

Pode ser sempre melhorada foi uma alteração que fiz para poder usar o group by no editor

Contributor guide

No contributing guide indexed for this repository

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 reading Editor.php, especially the _get($id = null, $http = null) method and the existing _ssp_query($query, $http) call. Confirm how query grouping is represented there, then verify that groupBy can set and retrieve the grouping and that generated queries apply it before the id condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, database
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.