UNPKG

ag-grid

Version:

Advanced Javascript Datagrid. Supports raw Javascript, AngularJS 1.x, AngularJS 2.0 and Web Components

27 lines (21 loc) 779 B
// this example has items declared globally. bad javascript. but keeps the example simple. var columnDefs = [ {headerName: "Make", field: "make"}, {headerName: "Model", field: "model"}, {headerName: "Price", field: "price"} ]; var rowData = [ {make: "Toyota", model: "Celica", price: 35000}, {make: "Ford", model: "Mondeo", price: 32000}, {make: "Porsche", model: "Boxter", price: 72000} ]; var gridOptions = { columnDefs: columnDefs, rowData: rowData }; // wait for the document to be loaded, otherwise // grid will not find the div in the document. document.addEventListener("DOMContentLoaded", function() { var myAgileGrid = document.querySelector('#myGrid'); myAgileGrid.setGridOptions(gridOptions); });