ag-grid
Version:
Advanced Javascript Datagrid. Supports raw Javascript, AngularJS 1.x, AngularJS 2.0 and Web Components
33 lines (26 loc) • 1.37 kB
JavaScript
var module = angular.module("example", ["agGrid"]);
module.controller("exampleCtrl", function($scope, $http) {
var irishAthletes = ['John Joe Nevin','Katie Taylor','Paddy Barnes','Kenny Egan','Darren Sutherland', 'Margaret Thatcher', 'Tony Blair', 'Ronald Regan', 'Barack Obama'];
var columnDefs = [
{headerName: "Athlete", field: "athlete", width: 150, filter: 'set',
filterParams: { cellHeight: 20, values: irishAthletes} },
{headerName: "Age", field: "age", width: 90, filter: 'number'},
{headerName: "Country", field: "country", width: 120},
{headerName: "Year", field: "year", width: 90},
{headerName: "Date", field: "date", width: 110},
{headerName: "Sport", field: "sport", width: 110},
{headerName: "Gold", field: "gold", width: 100, filter: 'number'},
{headerName: "Silver", field: "silver", width: 100, filter: 'number'},
{headerName: "Bronze", field: "bronze", width: 100, filter: 'number'},
{headerName: "Total", field: "total", width: 100, filter: 'number'}
];
$scope.gridOptions = {
columnDefs: columnDefs,
rowData: null,
enableFilter: true
};
$http.get("../olympicWinners.json")
.then(function(res){
$scope.gridOptions.api.setRowData(res.data);
});
});