[英]Completely disable a handsontable
I have just started using handsontable with JSON data and its working great but I need to disable all table input to certain users (read-only view). 我刚刚开始使用带有JSON数据的handontable并且它工作得很好但我需要禁用所有表输入到某些用户(只读视图)。
Is there a way to completely disable a handsontable so none of the inputs respond and the remove row plugin doesn't function? 有没有办法完全禁用一个handontable所以没有输入响应和删除行插件不起作用? I have tried http://dougestep.com/dme/jquery-disabler-widget-demos which doesn't seem to work and http://malsup.com/jquery/block/#element which works but it essentially creates an iframe overlay over the controls and with the removerow plugin the position is off set incorrectly.
我试过http://dougestep.com/dme/jquery-disabler-widget-demos这似乎不起作用和http://malsup.com/jquery/block/#element哪个有效,但它本质上创建了一个iframe覆盖控件和使用removerow插件,位置设置不正确。
To fully "disable" a Handsontable I have done the following: 要完全“禁用”Handsontable,我已完成以下操作:
hot.updateSettings({
readOnly: true, // make table cells read-only
contextMenu: false, // disable context menu to change things
disableVisualSelection: true, // prevent user from visually selecting
manualColumnResize: false, // prevent dragging to resize columns
manualRowResize: false, // prevent dragging to resize rows
comments: false // prevent editing of comments
});
You can do this using the updateSettings 您可以使用updateSettings执行此操作
var hot = $("#exampleGrid").handsontable('getInstance');
hot.updateSettings({
readOnly: true
});
Check the following link: http://jsfiddle.net/Hn3Zv/ 请查看以下链接: http : //jsfiddle.net/Hn3Zv/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.