删除handsontable的底边 [英] Remove the bottom margin of a handsontable

查看:82
本文介绍了删除handsontable的底边的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Mac OS Sierra 10.12.6下使用Chrome版本61.0.3163.100(正式版本)(64位)或Safari版本11.0(12604.1.38.1.7).

I am using Chrome Version 61.0.3163.100 (Official Build) (64-bit) or Safari Version 11.0 (12604.1.38.1.7) under Mac OS Sierra 10.12.6.

我想创建一个handontable,它的高度可能超过屏幕的高度:

I want to create a handsontable, whose height may exceeds the height of the screen:

https://jsbin.com/bobevafana/edit?html,输出

我意识到桌子下面总是有一个底部边距,有人知道如何删除它吗?

I realize that there is always a bottom margin below the table, does anyone know how to remove it?

var app = angular.module('app', ['ngHandsontable']);
app.controller('Ctrl', ['$scope', '$filter', '$timeout', 'hotRegisterer', function($scope, $filter, $timeout, hotRegisterer) {
  $scope.dataJson = [
    [5], [7], [5], [7], [5], [7], [5], [7], [5],
    [7], [5], [7], [5], [7], [5], [7], [5], [7],
    [5], [7], [5], [7], [5], [7], [5], [7], [5],
    [7], [5], [7], [5], [7], [5], [7], [5], [7],
    [5], [7], [5], [7], [5], [7], [5], [7], [5],
    [7], [5], [7], [5], [7], [5], [7]
  ];

  $scope.settings = {
    contextMenu: true,
    onAfterCreateRow: function(index, amount) {
      console.log("onAfterCreateRow");

      $timeout(function() {
        $scope.$digest();
      });

    }
  };
}]);

<!DOCTYPE html>
<html>

<head>
  <script src="https://handsontable.github.io/ngHandsontable/node_modules/angular/angular.js"></script>
  <script src="https://docs.handsontable.com/pro/1.8.2/bower_components/handsontable-pro/dist/handsontable.full.js"></script>
  <link type="text/css" rel="stylesheet" href="https://docs.handsontable.com/pro/1.8.2/bower_components/handsontable-pro/dist/handsontable.full.min.css">
  <script src="https://handsontable.github.io/ngHandsontable/dist/ngHandsontable.js"></script>
</head>

<body ng-app="app">
  <div ng-controller="Ctrl">
    <hot-table settings="settings" datarows="dataJson"></hot-table>
  </div>

</body>

</html>

推荐答案

在您的演示中我看到的是:添加到body而不是表中的默认浏览器样式(margin).

What I saw in that demo of yours is; the default browser style (margin) added to the body, and not the table.

body设置margin CSS属性可能会有所帮助.您可以在下面的代码段中或在以下位置自行检查: https://jsbin.com/qejekiqigo/1/edit?html,输出

Setting the margin CSS property for the body can be helpful. Check it out yourself below in the snippet, or here: https://jsbin.com/qejekiqigo/1/edit?html,output

var app = angular.module('app', ['ngHandsontable']);
app.controller('Ctrl', ['$scope', '$filter', '$timeout', 'hotRegisterer', function($scope, $filter, $timeout, hotRegisterer) {
  $scope.dataJson = [
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7],
    [5],
    [7]
  ];

  $scope.settings = {
    contextMenu: true,
    onAfterCreateRow: function(index, amount) {
      console.log("onAfterCreateRow");

      $timeout(function() {
        $scope.$digest();
      });

    }
  };
}]);

<!DOCTYPE html>
<html>

<head>
  <script src="https://handsontable.github.io/ngHandsontable/node_modules/angular/angular.js"></script>
  <script src="https://docs.handsontable.com/pro/1.8.2/bower_components/handsontable-pro/dist/handsontable.full.js"></script>
  <link type="text/css" rel="stylesheet" href="https://docs.handsontable.com/pro/1.8.2/bower_components/handsontable-pro/dist/handsontable.full.min.css">
  <script src="https://handsontable.github.io/ngHandsontable/dist/ngHandsontable.js"></script>
  <style>body { margin-bottom: 0; /* OR margin: 0; */ }</style>
</head>

<body ng-app="app">
  <div ng-controller="Ctrl">
    <hot-table settings="settings" datarows="dataJson"></hot-table>
  </div>

</body>

</html>

这篇关于删除handsontable的底边的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆