dijit » InlineEditBox » _edit
dijit.InlineEditBox._edit
dojo.require("dijit.InlineEditBox");
defined in dijit/InlineEditBox.js
display the editor widget in place of the original (read only) markup
Usage
function () (view source)
this.editing = true; var editValue = (this.renderAsHtml ? this.value : this.value.replace(/\s*\r?\n\s*/g,"").replace(/<br\/?>/gi, "\n").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")); // Placeholder for edit widget // Put place holder (and eventually editWidget) before the display node so that it's positioned correctly // when Calendar dropdown appears, which happens automatically on focus. var placeholder = dojo.doc.createElement("span"); dojo.place(placeholder, this.domNode, "before"); var ew = this.editWidget = new dijit._InlineEditor({ value: dojo.trim(editValue), autoSave: this.autoSave, buttonSave: this.buttonSave, buttonCancel: this.buttonCancel, renderAsHtml: this.renderAsHtml, editor: this.editor, editorParams: this.editorParams, style: dojo.getComputedStyle(this.displayNode), save: dojo.hitch(this, "save"), cancel: dojo.hitch(this, "cancel"), width: this.width }, placeholder); // to avoid screen jitter, we first create the editor with position:absolute, visibility:hidden, // and then when it's finished rendering, we switch from display mode to editor var ews = ew.domNode.style; this.displayNode.style.display="none"; ews.position = "static"; ews.visibility = "visible"; // Replace the display widget with edit widget, leaving them both displayed for a brief time so that // focus can be shifted without incident. (browser may needs some time to render the editor.) this.domNode = ew.domNode; setTimeout(function(){ ew.focus(); }, 100);