JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › Make grid readonly, allow selection and copy.
Is there a way to make SMART.Grid truly readonly, yet allow selection and copying from it?
I have editing.enabled = false, which seems to prevent editing, but the delete key and ctrl-X still cut content.
If I set clipboard.enabled = false, ctrl-X no longer cuts, but I also cannot copy with ctrl-C.
Thanks,
Chris Wardell
Hi,
You can leave the clipboard enabled and add a callback for the onKey event. In the callback, you will prevent the default behaviour if the ctrlKey is pressed and the keycode is KeyX.
onKey: (e) => { if(e.ctrlKey && e.code === “KeyX”) { e.preventDefault(); } }
Have a look at this demo: https://codepen.io/svetoslavb04/pen/gOzORrG
If you have any additional questions, do not hesitate to ask!
Best Regards, Svetoslav Borislavov
Smart UI Team https://www.htmlelements.com/
Thanks, Svetoslav! That works perfectly. I really appreciate the help.
Thank you for the update! I am so happy to hear that. If you need any help, let us know!