【问题标题】:In handsontable after select a day from date picker new row added在从日期选择器中选择一天后添加新行
【发布时间】:2023-03-25 12:15:01
【问题描述】:

我使用的是 handsontable 版本 10,从日期选择器中选择日期后出现问题,它会添加一个新行。我怎样才能禁用它?但我需要用“输入键”获得一个新行

任何人都可以使用此代码进行测试,

document.addEventListener("DOMContentLoaded", function() {
var container2 = document.getElementById('example2'),
hot2;


hot2 = new Handsontable(container2, {
data: Handsontable.helper.createSpreadsheetData(5, 5),
colHeaders: true,
minSpareRows: 1,
columns: [
    {
        type: 'date',
        dateFormat: 'MM/DD/YYYY',
        correctFormat: true,
        datePickerConfig: {
            firstDay: 0,
            showWeekNumber: true,
            numberOfMonths: 1,
            licenseKey: 'non-commercial-and-evaluation',
            disableDayFn(date) {
                // Disable Sunday and Saturday
                return date.getDay() === 0 || date.getDay() === 6;
            }
        }
    },
    {
        type: 'text',
    },
    {

    },
    {

    }
    ]  });});

【问题讨论】:

标签: javascript html datepicker handsontable


【解决方案1】:

在您的设置中,有一个minSpareRows: 1,每当您感觉任何最后一行中的这些单元格时,都会在表格中添加一个新行

所以当您在单元格索引5 中选择一个日期时,应用会自动添加一个新行。

【讨论】:

  • 感谢您的解释,我认为这是日期选择器的问题。
猜你喜欢
  • 1970-01-01
  • 2011-11-17
  • 2015-02-06
  • 2012-12-07
  • 2020-06-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多