ag-grid
Version:
Advanced Javascript Datagrid. Supports raw Javascript, AngularJS 1.x, AngularJS 2.0 and Web Components
31 lines (25 loc) • 1.18 kB
JavaScript
var module = angular.module("example", ["agGrid"]);
module.controller("exampleCtrl", function($scope, $http) {
var columnDefs = [
{headerName: "Athlete", field: "athlete", width: 150, sortingOrder: ['asc','desc']},
{headerName: "Age", field: "age", width: 90, sortingOrder: ['desc','asc']},
{headerName: "Country", field: "country", width: 120, sortingOrder: ['desc',null]},
{headerName: "Year", field: "year", width: 90, sortingOrder: ['asc']},
{headerName: "Date", field: "date", width: 110},
{headerName: "Sport", field: "sport", width: 110},
{headerName: "Gold", field: "gold", width: 100},
{headerName: "Silver", field: "silver", width: 100},
{headerName: "Bronze", field: "bronze", width: 100},
{headerName: "Total", field: "total", width: 100}
];
$scope.gridOptions = {
columnDefs: columnDefs,
rowData: null,
enableSorting: true,
sortingOrder: ['desc','asc',null]
};
$http.get("../olympicWinners.json")
.then(function(res){
$scope.gridOptions.api.setRowData(res.data);
});
});