New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ag-grid-community

Package Overview
Dependencies
Maintainers
4
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ag-grid-community

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

29.3.5
Source
npm
Version published
Weekly downloads
938K
1.27%
Maintainers
4
Weekly downloads
 
Created

What is ag-grid-community?

ag-grid-community is a feature-rich data grid designed for the major JavaScript frameworks. It provides a highly customizable and performant grid component that can handle large datasets and complex data operations.

What are ag-grid-community's main functionalities?

Basic Grid Setup

This code sets up a basic grid with three columns (Make, Model, Price) and three rows of data. It demonstrates how to define column definitions and row data for the grid.

const gridOptions = {
  columnDefs: [
    { headerName: 'Make', field: 'make' },
    { headerName: 'Model', field: 'model' },
    { headerName: 'Price', field: 'price' }
  ],
  rowData: [
    { make: 'Toyota', model: 'Celica', price: 35000 },
    { make: 'Ford', model: 'Mondeo', price: 32000 },
    { make: 'Porsche', model: 'Boxster', price: 72000 }
  ]
};

// Assuming you have a div with id 'myGrid'
new agGrid.Grid(document.getElementById('myGrid'), gridOptions);

Sorting

This code adds sorting functionality to the grid. By setting the 'sortable' property to true in the column definitions, users can sort the data by clicking on the column headers.

const gridOptions = {
  columnDefs: [
    { headerName: 'Make', field: 'make', sortable: true },
    { headerName: 'Model', field: 'model', sortable: true },
    { headerName: 'Price', field: 'price', sortable: true }
  ],
  rowData: [
    { make: 'Toyota', model: 'Celica', price: 35000 },
    { make: 'Ford', model: 'Mondeo', price: 32000 },
    { make: 'Porsche', model: 'Boxster', price: 72000 }
  ]
};

new agGrid.Grid(document.getElementById('myGrid'), gridOptions);

Filtering

This code adds filtering functionality to the grid. By setting the 'filter' property to true in the column definitions, users can filter the data using the filter input boxes that appear in the column headers.

const gridOptions = {
  columnDefs: [
    { headerName: 'Make', field: 'make', filter: true },
    { headerName: 'Model', field: 'model', filter: true },
    { headerName: 'Price', field: 'price', filter: true }
  ],
  rowData: [
    { make: 'Toyota', model: 'Celica', price: 35000 },
    { make: 'Ford', model: 'Mondeo', price: 32000 },
    { make: 'Porsche', model: 'Boxster', price: 72000 }
  ]
};

new agGrid.Grid(document.getElementById('myGrid'), gridOptions);

Pagination

This code adds pagination to the grid. By setting the 'pagination' property to true and defining 'paginationPageSize', the grid will display a limited number of rows per page and provide pagination controls.

const gridOptions = {
  pagination: true,
  paginationPageSize: 10,
  columnDefs: [
    { headerName: 'Make', field: 'make' },
    { headerName: 'Model', field: 'model' },
    { headerName: 'Price', field: 'price' }
  ],
  rowData: [
    { make: 'Toyota', model: 'Celica', price: 35000 },
    { make: 'Ford', model: 'Mondeo', price: 32000 },
    { make: 'Porsche', model: 'Boxster', price: 72000 },
    // Add more rows as needed
  ]
};

new agGrid.Grid(document.getElementById('myGrid'), gridOptions);

Other packages similar to ag-grid-community

Keywords

ag

FAQs

Package last updated on 15 May 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