首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当指定最大高度时,handson表不会滚动到新的备用行

当指定最大高度时,handson表不会滚动到新的备用行
EN

Stack Overflow用户
提问于 2015-07-09 00:36:51
回答 1查看 250关注 0票数 1

指定最大高度时,Handson表格不会自动滚动到新的备用行。即使在旧版本中也会发生这种情况:

代码语言:javascript
复制
document.addEventListener("DOMContentLoaded", function() {

  function getCarData() {
    return [
      ["Nissan", 2012, "black", "black"],
      ["Nissan", 2013, "blue", "blue"],
      ["Chrysler", 2014, "yellow", "black"],
      ["Volvo", 2015, "white", "gray"]
    ];
  }
  
  var
    data = [
      ['', 'Kia', 'Nissan', 'Toyota', 'Honda'],
      ['2013', 10, 11, 12, 13],
      ['2014', 20, 11, 14, 13],
      ['2015', 30, 15, 12, 13]
    ],
    container = document.getElementById('example1'),
    hot;
  
  hot = Handsontable(container, {
    data: data,
        minSpareRows:1,
        height : 130,
    rowHeaders: true,
    colHeaders: true
  });
  
  hot.selectCell(2,2);
  
  function bindDumpButton() {
      if (typeof Handsontable === "undefined") {
        return;
      }
  
      Handsontable.Dom.addEvent(document.body, 'click', function (e) {
  
        var element = e.target || e.srcElement;
  
        if (element.nodeName == "BUTTON" && element.name == 'dump') {
          var name = element.getAttribute('data-dump');
          var instance = element.getAttribute('data-instance');
          var hot = window[instance];
          console.log('data of ' + name, hot.getData());
        }
      });
    }
  bindDumpButton();

});
代码语言:javascript
复制
<!-- Copied from http://docs.handsontable.com/0.15.1/demo-highlighting-current.html -->
</style><!-- Ugly Hack due to jsFiddle issue -->

<script src="http://docs.handsontable.com/0.15.1/scripts/jquery.min.js"></script>
<script src="http://docs.handsontable.com/0.15.1/bower_components/handsontable/dist/handsontable.full.js"></script>
<link type="text/css" rel="stylesheet" href="http://docs.handsontable.com/0.15.1/bower_components/handsontable/dist/handsontable.full.min.css">
代码语言:javascript
复制
<div id="example1" class="hot handsontable"></div>

EN

回答 1

Stack Overflow用户

发布于 2015-07-09 03:32:58

你的问题是什么?你想要一种滚动到底部的方法吗?您可以只使用container.scrollTo(container.height),其中container.heightcontainer的高度;container.height可能不是正确的语法,我忘记了它是什么。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31298626

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档