DataGrid data binding

Local Data

Bind a plain Angular array when the full dataset is already available in memory.

Local binding is best for compact datasets, static reference data, or client-owned collections where the grid can sort, filter, and page the complete array without asking the server for every interaction.

Loading interactive DataGrid example…

Code snippet

      import { Component } from '@angular/core';
import { ColumnDef, Datagrid } from '@angular-bootstrap/ngbootstrap';

interface Order {
  product: string;
  category: string;
  status: string;
  amount: number;
}

@Component({
  standalone: true,
  imports: [Datagrid],
  template: `
    <ngb-datagrid
      [columns]="columns"
      [data]="orders"
      [enableSorting]="true"
      [filterable]="'row'"
      [pageable]="{ pageSizes: [5, 10, 25], info: true }"
      [pageSize]="5"
    />
  `,
})
export class LocalOrdersPage {
  readonly columns: ColumnDef<Order>[] = [
    { field: 'product', header: 'Product', sortable: true, filterable: true },
    { field: 'category', header: 'Category', filterable: true },
    { field: 'status', header: 'Status', filterable: true },
    { field: 'amount', header: 'Amount', type: 'number', sortable: true, filterable: true },
  ];

  readonly orders: Order[] = loadOrdersIntoMemory();
}
    

API information

APITypeUsage
[columns]ColumnDef<T>[]Defines visible fields, headers, widths, types, sorting, and filtering metadata.
[data]T[]Provides the full local collection. The grid processes this array in memory.
[enableSorting]booleanEnables header sorting for columns marked sortable: true.
[filterable]NgbFilterableRenders row, menu, multi-checkbox, or no filter UI depending on the configured mode.
[pageable]boolean | NgbDatagridPageableSettingsShows the pager and optional page-size controls for local pages.
[pageSize]numberControls how many local rows are shown per page.

This project is not affiliated with ng-bootstrap or ngx-bootstrap. Those projects focus mainly on Bootstrap components for Angular. ngbootstrap focuses on Angular UI for data-heavy apps, especially Data Grid, Angular-native Form Builder, drag and drop workflows, documentation examples, and performance-focused Angular patterns.