【问题标题】:How to add row delete confirmation message on handsontable如何在handsontable上添加行删除确认消息
【发布时间】:2015-11-25 15:45:43
【问题描述】:

在可操作的 row_remove 上下文菜单中,是否可以在删除行之前附加确认消息,以便用户可以选择取消请求?

【问题讨论】:

    标签: javascript handsontable


    【解决方案1】:

    是的。在文档中有一个beforeRemoveRow,可用于在删除行之前调用函数。

    您可以在表格的声明中使用它:

    $(document).ready(function () {
    
      var container = document.getElementById('basic_example');
    
      var data = function () {
       return Handsontable.helper.createSpreadsheetData(100, 12);
      };
    
      var hot = new Handsontable(container, {
        data: data(),
        height: 396,
        colHeaders: true,
        rowHeaders: true,
        stretchH: 'all',
        columnSorting: true,
        contextMenu: true,
        beforeRemoveRow: function(){return confirm("Are you sure you want to remove this row?")}
      });
    
    });
    

    这里有一个Fiddle 的例子。

    【讨论】:

      猜你喜欢
      • 2013-06-07
      • 2020-04-06
      • 2013-05-18
      • 2021-12-05
      • 1970-01-01
      • 1970-01-01
      • 2020-02-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多