Row Grouping - Datatables for Laravel                  [               Datatables for Laravel  ](/) 

  Toggle main menu         [Docs](https://laravel-datatables.com/docs) [Demos](/demos) [Blog](https://laravel-datatables.com/blog) [Pricing](/pricing)        Search  ⌘ K   [ Log in ](/login) 

  [Docs](https://laravel-datatables.com/docs) [Demos](/demos) [Blog](https://laravel-datatables.com/blog) [Pricing](/pricing) 

 Search docs and demos  

Type at least 2 characters to search.

    Demos menu     ### Use Cases

- [ Simple Datatable ](/demos)
- [ Products Datatable ](/demos/use-case-products)
- [ Sales Operations ](/demos/use-case-sales)

### Features

- [ Accessibility ](/demos/features-accessibility)
- [ Advanced Filtering ](/demos/features-advanced-filtering)
- [ Column Reordering ](/demos/features-column-reordering)
- [ Directionality (LTR / RTL) ](/demos/features-directionality)
- [ Export ](/demos/features-export)
- [ Pagination ](/demos/features-pagination)
- [ Frozen Columns ](/demos/features-frozen-columns)
- [ Frozen Header ](/demos/features-frozen)
- [ Frozen Header &amp; Columns ](/demos/features-frozen-both)
- [ Responsive Mobile ](/demos/features-responsive-mobile)
- [ Row Grouping ](/demos/features-row-grouping)
- [ Aggregate Totals ](/demos/features-aggregate-totals)
- [ Row Selection &amp; Bulk Actions ](/demos/features-row-selection-bulk-actions)
- [ Custom Controls ](/demos/features-custom-controls)

### Cell Renderer

- [ Action Buttons ](/demos/cell-renderer-action-buttons)
- [ Avatar ](/demos/cell-renderer-avatar)
- [ Checkmark ](/demos/cell-renderer-checkmark)
- [ Color Sample ](/demos/cell-renderer-color-sample)
- [ Email Link ](/demos/cell-renderer-email)
- [ External Link ](/demos/cell-renderer-external)
- [ Friendly Timestamp ](/demos/cell-renderer-friendly-timestamp)
- [ Image ](/demos/cell-renderer-image)
- [ Long Text ](/demos/cell-renderer-long-text)
- [ Phone Link ](/demos/cell-renderer-phone-link)
- [ Progress Bar ](/demos/cell-renderer-progress-bar)
- [ Status Badge ](/demos/cell-renderer-status-badge)
- [ Url Link ](/demos/cell-renderer-url)
- [ Wire Link ](/demos/cell-renderer-wire)

### Value Formatter

- [ Compact Number ](/demos/value-formatter-compact-number)
- [ Currency ](/demos/value-formatter-currency)
- [ Duration ](/demos/value-formatter-duration)
- [ Friendly Filesize ](/demos/value-formatter-friendly-filesize)
- [ Friendly Timestamp ](/demos/value-formatter-friendly-timestamp)
- [ Locale Timestamp ](/demos/value-formatter-locale-timestamp)
- [ Number ](/demos/value-formatter-number)
- [ Percent ](/demos/value-formatter-percent)

 Row Grouping
============

Use `$groupBy` to organize the rows into category groups. Use the switcher to compare the `PageSummary`, `GlobalTotals`, and `GroupPagination` strategies, which are set through the `$groupingStrategy` property.

The `column()` method defines an on-the-fly column `TotalPrice` using a custom formatter called `PrepareTotalPrice` to evaluate its value and applies the `aggregate()` column configuration to keep a running total of the category group.

When you paginate along the table you will notice that the aggregation will automatically detect multiple currencies and provide separate totals for each currency in the group footer.

The `PageSummary` strategy shows every group with its records and a summary row calculated from the current page.

Switch to the `GlobalTotals` strategy to calculate totals for the entire filtered dataset, while keeping the rows paginated.

Switch to the `GroupPagination` strategy to add group-level pagination and expandable group controls. Each group is then collapsed behind a Show button, and the second switcher sets the `$groupExpansionMode` property: `AllRows` reveals every row of an expanded group, while `PaginatedRows` paginates them using `$groupExpansionPerPage`.

 Related documentation

 [ Row Grouping ](https://laravel-datatables.com/docs/feature-row-grouping) [ Aggregate Columns ](https://laravel-datatables.com/docs/feature-aggregate-columns) [ Value Preparation ](https://laravel-datatables.com/docs/feature-value-preparation) 

 Related demos

 [ Aggregate Totals ](https://laravel-datatables.com/demos/features-aggregate-totals) 

 Grouping strategy

Choose how group totals are calculated and how grouped rows are paginated.

  Page Summary   Global Totals   Group Pagination  

 Group expansion mode

Choose whether an expanded group shows all of its rows or paginates them.

  All Rows   Paginated Rows  

          Items per page        Filters      Export        Columns   

    10  Current    25    50    100    

     CSV   XLSX   PDF   

 ​### Filter options

   Product Name      

  Category    All  Accessories Hardware Services Software Subscriptions     

 Clear all Done 

 ​###  Manage Columns 

     ID      Product Name      Category      Status      Units Sold      Unit Price      Total Price     

  Apply   Cancel  

       Loading... 

              ID                Product Name                Category                Status                Units Sold                Unit Price               Total Price       Actions              Category:  Accessories  

 10 rows 

                  222       Sapiente magnam voluptatem       Accessories       Active       56.0       €456.71       €25,575.76       View Edit Delete

                  237       Expedita quod       Accessories       Active       117.0       €247.96       €29,011.32       View Edit Delete

                  313       Sunt assumenda rem       Accessories       Active       153.0       €183.84       €28,127.52       View Edit Delete

                  255       Omnis vitae accusamus ipsam       Accessories       Active       121.0       €802.96       €97,158.16       View Edit Delete

                  253       Exercitationem explicabo inventore esse       Accessories       Active       41.0       €730.71       €29,959.11       View Edit Delete

                  211       Non dolores laboriosam       Accessories       Active       104.0       €1,123.70       €116,864.80       View Edit Delete

                  310       Exercitationem consectetur doloremque       Accessories       Active       136.0       €1,286.90       €175,018.40       View Edit Delete

                  247       Fugiat necessitatibus nam voluptatem       Accessories       Inactive       114.0       €1,377.43       €157,027.02       View Edit Delete

                  309       Repellendus nemo       Accessories       Active       243.0       €470.75       €114,392.25       View Edit Delete

                  260       Reprehenderit totam       Accessories       Active       220.0       €1,378.15       €303,193.00       View Edit Delete

                  Total                                       €1,076,327.34 

        « Previous       Next »    

 1 - 10 of 320

                    1       2       3       4       5       6       7       8       9       10        ...          31       32                 

          Items per page        Filters      Export        Columns   

    10  Current    25    50    100    

     CSV   XLSX   PDF   

 ​### Filter options

   Product Name      

  Category    All  Accessories Hardware Services Software Subscriptions     

 Clear all Done 

 ​###  Manage Columns 

     ID      Product Name      Category      Status      Units Sold      Unit Price      Total Price     

  Apply   Cancel  

       Loading... 

              ID                Product Name                Category                Status                Units Sold                Unit Price               Total Price       Actions              Category:  Accessories  

 55 rows 

                  222       Sapiente magnam voluptatem       Accessories       Active       56.0       €456.71       €25,575.76       View Edit Delete

                  237       Expedita quod       Accessories       Active       117.0       €247.96       €29,011.32       View Edit Delete

                  313       Sunt assumenda rem       Accessories       Active       153.0       €183.84       €28,127.52       View Edit Delete

                  255       Omnis vitae accusamus ipsam       Accessories       Active       121.0       €802.96       €97,158.16       View Edit Delete

                  253       Exercitationem explicabo inventore esse       Accessories       Active       41.0       €730.71       €29,959.11       View Edit Delete

                  211       Non dolores laboriosam       Accessories       Active       104.0       €1,123.70       €116,864.80       View Edit Delete

                  310       Exercitationem consectetur doloremque       Accessories       Active       136.0       €1,286.90       €175,018.40       View Edit Delete

                  247       Fugiat necessitatibus nam voluptatem       Accessories       Inactive       114.0       €1,377.43       €157,027.02       View Edit Delete

                  309       Repellendus nemo       Accessories       Active       243.0       €470.75       €114,392.25       View Edit Delete

                  260       Reprehenderit totam       Accessories       Active       220.0       €1,378.15       €303,193.00       View Edit Delete

                  Total                                       €5,824,406.62 

        « Previous       Next »    

 1 - 10 of 320

                    1       2       3       4       5       6       7       8       9       10        ...          31       32                 

          Items per page        Filters      Export        Columns   

    10  Current    25    50    100    

     CSV   XLSX   PDF   

 ​### Filter options

   Product Name      

  Category    All  Accessories Hardware Services Software Subscriptions     

 Clear all Done 

 ​###  Manage Columns 

     ID      Product Name      Category      Status      Units Sold      Unit Price      Total Price     

  Apply   Cancel  

       Loading... 

              ID                Product Name                Category                Status                Units Sold                Unit Price               Total Price       Actions              Show    Category:  Accessories  

 55 rows 

           Show    Category:  Hardware  

 80 rows 

           Show    Category:  Services  

 63 rows 

           Show    Category:  Software  

 47 rows 

           Show    Category:  Subscriptions  

 75 rows 

          Items per page        Filters      Export        Columns   

    10  Current    25    50    100    

     CSV   XLSX   PDF   

 ​### Filter options

   Product Name      

  Category    All  Accessories Hardware Services Software Subscriptions     

 Clear all Done 

 ​###  Manage Columns 

     ID      Product Name      Category      Status      Units Sold      Unit Price      Total Price     

  Apply   Cancel  

       Loading... 

              ID                Product Name                Category                Status                Units Sold                Unit Price               Total Price       Actions              Show    Category:  Accessories  

 55 rows 

           Show    Category:  Hardware  

 80 rows 

           Show    Category:  Services  

 63 rows 

           Show    Category:  Software  

 47 rows 

           Show    Category:  Subscriptions  

 75 rows 

 - Demo code is available for licensed customers - 

   © 2026 Copyright (C)  [ Morrow IT Consulting &amp; Services ](https://morrow-it.services)  

 [Terms of Service](https://laravel-datatables.com/legal/terms) [Privacy](https://laravel-datatables.com/legal/privacy) [Legal Disclosure](https://laravel-datatables.com/legal/disclosure)
