|
| 1 | +<!DOCTYPE html> |
| 2 | +<html class="no-js" ng-app="test"><!--<![endif]--> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"> |
| 6 | + <title></title> |
| 7 | + <meta content="width=device-width" name="viewport"> |
| 8 | + |
| 9 | + <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" /> |
| 10 | + <link href="/dist/release/ui-grid.css" rel="stylesheet"> |
| 11 | + |
| 12 | + <script src="//code.jquery.com/jquery-2.1.3.min.js"></script> |
| 13 | + <script src="/lib/test/angular/1.2.26/angular.js"></script> |
| 14 | + <script src="/dist/release/ui-grid.js"></script> |
| 15 | + |
| 16 | + <style> |
| 17 | + body { |
| 18 | + padding: 60px; |
| 19 | + min-height: 600px; |
| 20 | + } |
| 21 | + .grid { |
| 22 | + width: 500px; |
| 23 | + height: 400px; |
| 24 | + } |
| 25 | + .placeholder { |
| 26 | + height: 50%; |
| 27 | + width: 50%; |
| 28 | + border: 3px solid black; |
| 29 | + background: #ccc; |
| 30 | + } |
| 31 | + </style> |
| 32 | +</head> |
| 33 | +<body ng-controller="Main"> |
| 34 | +<!-- <h1>Test</h1> --> |
| 35 | + |
| 36 | +<!-- <div class="row main"> --> |
| 37 | +<h2>Grid</h2> |
| 38 | +<button type="button" ng-click="swap()">Swap Columns</button> |
| 39 | +<br> |
| 40 | +<br> |
| 41 | +<div ui-grid="gridOptions" class="grid" ui-grid-cellnav ui-grid-expandable></div> |
| 42 | +<!-- <div class="placeholder"> --> |
| 43 | +<!-- </div> --> |
| 44 | + |
| 45 | +<br> |
| 46 | +<br> |
| 47 | + |
| 48 | +<script> |
| 49 | + var app = angular.module('test', ['ui.grid', 'ui.grid.expandable', 'ui.grid.cellNav']); |
| 50 | + app.controller('Main', function($scope, $http) { |
| 51 | + $scope.gridOptions = { |
| 52 | + expandableRowTemplate: 'subgrid', |
| 53 | + expandableRowHeight: 150, |
| 54 | + }; |
| 55 | + $scope.gridOptions.columnDefs = [ |
| 56 | + { field:'id' }, |
| 57 | + { field:'name' }, |
| 58 | + { field:'age' } |
| 59 | + ]; |
| 60 | + |
| 61 | + $http.get('https://rawgit.com/angular-ui/ui-grid.info/gh-pages/data/500_complex.json') |
| 62 | + .success(function(data) { |
| 63 | + data.forEach(function (d) { |
| 64 | + d.subGridOptions = { |
| 65 | + columnDefs: [ { field: "company" }, { field: "email" } ], |
| 66 | + data: data.slice(0, 100) |
| 67 | + }; |
| 68 | + }); |
| 69 | + |
| 70 | + $scope.gridOptions.data = data; |
| 71 | + }); |
| 72 | + }); |
| 73 | +</script> |
| 74 | + |
| 75 | +<script type="text/ng-template" id="subgrid"> |
| 76 | + <div ui-grid="row.entity.subGridOptions" style="height:140px;"></div> |
| 77 | +</script> |
| 78 | + |
| 79 | +</body> |
| 80 | +</html> |
0 commit comments