How can I toggle whether a data table is editable?

I tried the define and refresh approach mentioned in the docs, but it had no effect. Now I’m at a loss. Is this possible?

        ...
        {view:"toggle",
         type:"iconButton",
         offIcon:"unlock",
         onIcon:"lock",
         offLabel:"Edit",
         onLabel:"Read",
         inputWidth:80,
         width:80,
         value:"Read",
         click: function() {
             // TODO: This doesn't work!
             if(this.getValue() === "Read") {
                 $$(dtbl_id).define("editable", true);
                 $$(dtbl_id).refresh();
             } else {
                 $$(dtbl_id).define("editable", false);
                 $$(dtbl_id).refresh();
             }
         },
         align:"right"}
         ...

You can check whether cells are editable or not via the onBeforeEdit event.

http://webix.com/snippet/7b1ed9bd

Works for me. Thanks a lot!