Html 如何使ui网格响应AngularJS中的高度
我试图使我的网格响应,而不是移动,只是当用户调整窗口大小。 我正在使用ui网格自动调整大小,但它只调整宽度大小。高度不变 我试图添加一个指令Html 如何使ui网格响应AngularJS中的高度,html,angularjs,ui-grid,Html,Angularjs,Ui Grid,我试图使我的网格响应,而不是移动,只是当用户调整窗口大小。 我正在使用ui网格自动调整大小,但它只调整宽度大小。高度不变 我试图添加一个指令 app.directive('resize', ['$window', function ($window) { return function (scope, element, attr) { var w = angular.element($window); scope.$watch(function () { ret
app.directive('resize', ['$window', function ($window) {
return function (scope, element, attr) {
var w = angular.element($window);
scope.$watch(function () {
return {
'h': window.innerHeight,
'w': window.innerWidth
};
}, function (newValue, oldValue) {
scope.windowHeight = newValue.h;
scope.windowWidth = newValue.w;
debugger;
scope.resizeWithOffset = function (offsetH) {
scope.$eval(attr.notifier);
return {
'height': (newValue.h - offsetH) + 'px'
};
};
}, true);
w.bind('resize', function () {
scope.$apply();
});
}
}])
还有我的网格
<div ui-grid="gridOptions" class="grid testTrans nopadding" ui-grid-selection ui-grid-auto-resize ui-grid-exporter ui-grid-move-columns ng-style="resizeWithOffset(pageOffSetY)" rezise>
<div class="well grid-loading" ng-show="grid.rows.length == 0">
<i class="fa fa-spin fa-spinner"></i>
<strong>Data Loading...</strong>
</div>
</div>
数据加载…
我在代码中加入了一些调试器,但它从未通过。对我有效的还有:
<div layout="row" flex style="margin: 0;position: relative;"
ng-style="resizeWithOffset(323)" resize >
<div ui-grid="gridOptions"
class="wm-dashboard-grid"
style="position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;"
ng-style="resizeWithOffset(325)" resize
ui-grid-auto-resize
ui-grid-pagination
ui-grid-selection
ui-grid-resize-columns>
</div>
</div>
只需调整屏幕大小您想调整
ui网格高度,即垂直滚动还是单元格高度?