【问题标题】:Handsontable: Turn off auto-resizing rows (How to set a fixed height?)Handsontable:关闭自动调整行大小(如何设置固定高度?)
【发布时间】:2016-04-29 12:23:18
【问题描述】:

自动调整大小的行为在 handsontable 中有点不寻常。我只想为所有不会扩展的行设置固定的行高,除非您单击它,或者手动将其向下拖动,就像在 excel 中一样。我还想手动将所有行的高度设置为相同的高度,而不是根据最高行计算它。

我试过了:

'height' => 50 添加到我的列中,添加manualRowResize: true,并使用manualRowResize: [50, 50, 50] 为几行添加固定高度,但是当我的数据跨越多行时(例如,以html 呈现时),它不会' t 保持在一个固定的高度。

【问题讨论】:

    标签: javascript jquery handsontable


    【解决方案1】:

    Handsontable - Resizing rows and columns

    也许rowHeights 就是你想要的。

    var
        container = document.getElementById('example1'),
        hot;
    
    hot = new Handsontable(container, {
        data: Handsontable.helper.createSpreadsheetData(200, 10),
        rowHeaders: true,
        colHeaders: true,
        colWidths: [55, 80, 80, 80, 80, 80, 80],
        rowHeights: [50, 40, 100], // <-- this one sets fixed row height
        manualColumnResize: true,
        manualRowResize: true
    });
    

    【讨论】:

    • 那个'天才伙伴! colWidths: 为我工作!即使使用stretchH: 'all', 这也很棒,因为这样您就不必考虑设置了什么值:结果是当您添加一个长值时重新调整整个collum 是overflow: hidden
    猜你喜欢
    • 2015-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-14
    • 2021-02-10
    • 2011-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多