简体   繁体   English

如何阻止用户在handsontable中删除标题行中的单元格?

[英]How can I stop users removing cells in the header row in handsontable?

I want to make it so that the header row is not editable. 我想这样做,使标题行不可编辑。 I have managed to make it read only which means when they left click the cell they cannot edit it. 我设法让它只读,这意味着当他们左键单击他们无法编辑它的单元格。 However, they can right click the cell and choose remove row or column. 但是,他们可以右键单击单元格并选择删除行或列。

One way to do this is perhaps, intercept the bit where they remove the row or column and then check if that cell is readOnly or not. 一种方法是拦截它们删除行或列的位,然后检查该单元格是否为readOnly。 But how can I do this with Handsontables? 但是我怎么能用Handsontables做到这一点?

You can set contextMenu: false in the options, or you can configure the context menu to not display "Remove Column" and "Remove Row": 您可以在选项中设置contextMenu: false ,也可以将上下文菜单配置为不显示“删除列”和“删除行”:

http://handsontable.com/demo/contextmenu.html http://handsontable.com/demo/contextmenu.html

您应该使用colHeaders,因此该行不能右键单击,您可以将其定义为数组或使用函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM