-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(uiGrid): Wait for grid to get dimensions
If the grid has no width initially, wait for up to 2 seconds for the grid to be shown and have dimensions. Once that happens it will re-initialize its height and width and redraw the canvas. This should fix the problems with the grid taking up too much space in a modal. BREAKING CHANGE: gridUtil will no longer calculate dimensions of hidden elements
- Loading branch information
Showing
7 changed files
with
205 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<!DOCTYPE html> | ||
<html ng-app="app"> | ||
|
||
<head> | ||
<link data-require="bootstrap@*" data-semver="3.3.2" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" /> | ||
<script data-require="jquery@2.1.3" data-semver="2.1.3" src="http://code.jquery.com/jquery-2.1.3.min.js"></script> | ||
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.js"></script> | ||
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular-touch.js"></script> | ||
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular-animate.js"></script> | ||
<script data-require="ui-bootstrap@*" data-semver="0.12.1" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.1.min.js"></script> | ||
<script src="http://ui-grid.info/docs/grunt-scripts/csv.js"></script> | ||
<script src="http://ui-grid.info/docs/grunt-scripts/pdfmake.js"></script> | ||
<script src="http://ui-grid.info/docs/grunt-scripts/vfs_fonts.js"></script> | ||
<script src="/dist/release/ui-grid.js"></script> | ||
<link rel="stylesheet" href="/dist/release/ui-grid.css" type="text/css" /> | ||
<style type="text/css"> | ||
.grid { | ||
width: 100%; | ||
max-width: 600px; | ||
height: 400px; | ||
} | ||
|
||
body { | ||
padding: 20px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div ng-controller="MainCtrl"> | ||
<button ng-click="openModal()" class="btn btn-success">Open Modal</button> | ||
</div> | ||
|
||
<script> | ||
var app = angular.module('app', ['ui.grid', 'ui.bootstrap']); | ||
|
||
app.controller('MainCtrl', function ($scope, $modal) { | ||
$scope.openModal = function () { | ||
$modal.open({ | ||
templateUrl: 'modal.html' | ||
}); | ||
} | ||
}); | ||
|
||
app.controller('ModalDemoCtrl', function ($scope, $http) { | ||
$scope.gridOptions = {}; | ||
|
||
$http.get('https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/500_complex.json') | ||
.success(function(data) { | ||
$scope.gridOptions.data = data; | ||
}); | ||
}); | ||
</script> | ||
|
||
<script type="text/ng-template" id="modal.html"> | ||
<div ng-controller="ModalDemoCtrl"> | ||
<div class="modal-header"> | ||
<h3 class="modal-title">I'm a modal!</h3> | ||
</div> | ||
<div class="modal-body"> | ||
<div id="grid1" ui-grid="gridOptions" class="grid"></div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn btn-warning" ng-click="$close()">Cancel</button> | ||
</div> | ||
<div ng-show="selected">Selection from a modal: {{ selected }}</div> | ||
</div> | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
} | ||
|
||
return width; | ||
} | ||
} | ||
} | ||
|
||
function updateContainerDimensions() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters