Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ag-grid-enterprise/row-grouping

Package Overview
Dependencies
Maintainers
3
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ag-grid-enterprise/row-grouping

Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue

  • 29.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
222K
increased by6%
Maintainers
3
Weekly downloads
 
Created

What is @ag-grid-enterprise/row-grouping?

@ag-grid-enterprise/row-grouping is an npm package that provides advanced row grouping functionalities for ag-Grid, a popular JavaScript data grid. It allows users to group rows by specific columns, aggregate data, and customize the grouping behavior to suit various data visualization needs.

What are @ag-grid-enterprise/row-grouping's main functionalities?

Basic Row Grouping

This code demonstrates basic row grouping by the 'country' column. The 'country' column is set to group rows, and the grid is populated with data fetched from a server.

const gridOptions = {
  columnDefs: [
    { field: 'athlete' },
    { field: 'age' },
    { field: 'country', rowGroup: true },
    { field: 'year' },
    { field: 'date' },
    { field: 'sport' },
    { field: 'gold' },
    { field: 'silver' },
    { field: 'bronze' }
  ],
  defaultColDef: {
    sortable: true,
    filter: true
  },
  autoGroupColumnDef: {
    headerName: 'Group',
    field: 'athlete',
    cellRenderer: 'agGroupCellRenderer',
    cellRendererParams: {
      checkbox: true
    }
  },
  rowData: null
};

// setup the grid after the page has finished loading
const eGridDiv = document.querySelector('#myGrid');
new agGrid.Grid(eGridDiv, gridOptions);

// fetch data from server
fetch('https://www.ag-grid.com/example-assets/olympic-winners.json')
  .then(response => response.json())
  .then(data => gridOptions.api.setRowData(data));

Custom Aggregation

This code demonstrates custom aggregation functions. The 'age' column uses the 'avg' aggregation function, while the 'gold', 'silver', and 'bronze' columns use the 'sum' aggregation function.

const gridOptions = {
  columnDefs: [
    { field: 'athlete' },
    { field: 'age', aggFunc: 'avg' },
    { field: 'country', rowGroup: true },
    { field: 'year' },
    { field: 'date' },
    { field: 'sport' },
    { field: 'gold', aggFunc: 'sum' },
    { field: 'silver', aggFunc: 'sum' },
    { field: 'bronze', aggFunc: 'sum' }
  ],
  defaultColDef: {
    sortable: true,
    filter: true
  },
  autoGroupColumnDef: {
    headerName: 'Group',
    field: 'athlete',
    cellRenderer: 'agGroupCellRenderer',
    cellRendererParams: {
      checkbox: true
    }
  },
  rowData: null
};

// setup the grid after the page has finished loading
const eGridDiv = document.querySelector('#myGrid');
new agGrid.Grid(eGridDiv, gridOptions);

// fetch data from server
fetch('https://www.ag-grid.com/example-assets/olympic-winners.json')
  .then(response => response.json())
  .then(data => gridOptions.api.setRowData(data));

Custom Grouping

This code demonstrates custom grouping with the 'groupDefaultExpanded' property set to 1, which means that the first level of groups will be expanded by default.

const gridOptions = {
  columnDefs: [
    { field: 'athlete' },
    { field: 'age' },
    { field: 'country', rowGroup: true },
    { field: 'year' },
    { field: 'date' },
    { field: 'sport' },
    { field: 'gold' },
    { field: 'silver' },
    { field: 'bronze' }
  ],
  defaultColDef: {
    sortable: true,
    filter: true
  },
  autoGroupColumnDef: {
    headerName: 'Group',
    field: 'athlete',
    cellRenderer: 'agGroupCellRenderer',
    cellRendererParams: {
      checkbox: true
    }
  },
  groupDefaultExpanded: 1,
  rowData: null
};

// setup the grid after the page has finished loading
const eGridDiv = document.querySelector('#myGrid');
new agGrid.Grid(eGridDiv, gridOptions);

// fetch data from server
fetch('https://www.ag-grid.com/example-assets/olympic-winners.json')
  .then(response => response.json())
  .then(data => gridOptions.api.setRowData(data));

Other packages similar to @ag-grid-enterprise/row-grouping

Keywords

FAQs

Package last updated on 17 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc