【问题标题】:Handsontable firstrow misalignedHandsontable 第一行未对齐
【发布时间】:2016-09-02 12:01:41
【问题描述】:

我使用的是最新的 0.24.3 版本,但仍然遇到这个问题。每次表格渲染时,第一行总是未对齐并隐藏在标题下。

这是我目前的代码。

$scope.populateTable = function(data){
        var container = document.getElementById('priceSettingContent');
        $scope.hotPricing = new Handsontable(container, {
            data: data ,
            rowHeaders: false,
            colHeaders: ['Article Number','Color','Size','EAN', 'Local Distribution Channel','Published Selling Price',
                    'Suggested Retail Price','Purchase Cost','Currency','Last Update'],
            columnSorting: false,
            contextMenu: false,
            columns: [
                    {
                        data: 'articleNumber',
                        readOnly: true,
                        disableVisualSelection: true
                    },
                    {
                        data: 'colorCode',
                        readOnly: true,
                        disableVisualSelection: true
                    },
                    {
                        data: 'size',
                        readOnly: true,
                        disableVisualSelection: true
                    },
                    {
                        data: 'ean',readOnly:
                        true, disableVisualSelection: true
                    },
                    {
                        data: 'distList',
                        readOnly: true,
                        disableVisualSelection: true
                    },
                    {
                        data: 'publishedSellingPrice',
                        type: 'numeric',
                        format: '0,0.00',
                        language: 'en',
                        validator: $scope.currencyValidator,
                        allowInvalid: false,
                    },
                    {
                        data: 'suggestedRetailPrice',
                        type: 'numeric',
                        format: '0,0.00',
                        language: 'en',
                        validator: $scope.currencyValidator,
                        allowInvalid: false
                    },
                    {
                        data: 'purchaseCost',
                        type: 'numeric',
                        format: '0,0.00',
                        language: 'en',
                        validator: $scope.currencyValidator,
                        allowInvalid: false
                    },
                    {
                        data: 'currencyCode',
                        readOnly: true,
                        disableVisualSelection: true
                    },
                    {
                        data: 'dateModified',
                        readOnly: true,
                        disableVisualSelection: true
                    },
        ]
            renderAllRows: true,
            height: function(){
                return 400;
            },
            stretchH: 'all',
            afterChange: function(change, source){	
                if(source != 'loadData'){
                    $scope.extractData(change);
                }
            },
            afterCreateRow: function(index, amount){
                data.splice(index, amount)
            },
            tableClassName: ['table-hover', 'table-striped','table-responsive'],
            manualColumnResize: true,
            cells: function(row, col, prop) {
                var cellProperties = {};
                if (row === 0, col === 0) {
                    cellProperties.renderer = $scope.articleNameRenderer;
                }
                return cellProperties;
            }
        });
    }
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

每次表格呈现时都会发生这种情况。

【问题讨论】:

  • 嗨@Tushar,我已经添加了生成表格的代码

标签: javascript css handsontable


【解决方案1】:

它现在可以工作了,在对 css 进行调试和跟踪之后,我终于找到了罪魁祸首。我不知道这是否是最好的方法,但我希望遇到相同问题的人可以应用此方法。打开handontable的css文件并编辑这部分并添加max-height。

.ht_clone_top .wtHolder,
.ht_clone_bottom .wtHolder {
  overflow-x: auto;
  overflow-y: hidden;
  max-height: 35px; /* add max height */
}

就是这样!

【讨论】:

    猜你喜欢
    • 2012-05-23
    • 2019-08-11
    • 1970-01-01
    • 2014-05-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-13
    • 2016-02-07
    相关资源
    最近更新 更多