Hi, John! How difficult is to add a groupBy() method to GCE? It would be a nice companion to defaultOrdering().
Thanks.
post by bgeneto on Jul 13, 2023
post by johnny on Jul 17, 2023
Hello @bgeneto ,
groupBy is a more complicated one since it is changing the number of rows. For now maybe you can create a custom model with any extra more complicated queries. For example a custom model that can look like the example here: setModel | Grocery CRUD - A PHP CRUD Generator Library
<?php
use GroceryCrud\Core\Model;
class customModel extends Model {
public function extraWhereStatements($select)
{
// please keep in mind that the syntax is from lamina-db
$select->group('category');
return $select;
}
}
As I am not sure if this will work out of the box, maybe you need to create a more complicated customModel as per example here: Custom Model | Grocery CRUD - A PHP CRUD Generator Library
I will have it in mind though maybe to have the groupBy as a future implementation.
Regards
Johnny
New & Unread Topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Use callbackColumn() but keep inline edit functionality |
|
3 | 654 | Apr 12 |
| Setting quick search values via JavaScript not working properly for booleans |
|
0 | 566 | Nov 2025 |
| callbackColumn() has not effect in v3.2.6 Enterprise |
|
2 | 698 | Dec 2025 |
| PRINT date format not consistent |
|
6 | 360 | Sep 7 |
| “Ooooops, something went wrong! If you can see this message, this is probably a misconfiguration in Grocery CRUD Enterprise!” |
|
6 | 267 | 8d |