InPlaceEditor
23 Sep 202515 minutes to read
* The In-place editor control is used to edit an element in a place and to update the value in server.
<div id='element' />
<script>
var editorObj = new InPlaceEditor();
editorObj.appendTo('#element');
</script>Properties
actionOnBlur ActionBlur
Specifies the action to be perform when user clicks outside the container, that is focus out of editable content.
The possible options are,
-
Cancel: Cancel’s the editing and resets the old content. -
Submit: Submit the edited content to the server. -
Ignore: No action is perform with this type and allows to have many containers open.
Defaults to ‘Submit’
adaptor AdaptorType
Specifies the adaptor type that are used DataManager to communicate with DataSource. The possible values are,
-
UrlAdaptor: Base adaptor for interacting with remote data services. -
ODataV4Adaptor: Used to interact with ODataV4 service. -
WebApiAdaptor: Used to interact with Web api created with OData endpoint.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
adaptor :'UrlAdaptor',
});
editObj.appendTo('#inplace_editor');Defaults to ‘UrlAdaptor’
cancelButton ButtonModel
Used to customize the “Cancel” button UI appearance by defining Button model configuration.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
cancelButton : { iconCss: 'e-icons e-cancel-icon' }
});
editObj.appendTo('#inplace_editor');Defaults to { iconCss: ‘e-icons e-cancel-icon’ }
cssClass string
Defines single/multiple classes (separated by space) to be used for customization of In-place editor.
Defaults to ’’
disabled boolean
Specifies whether to enable editing mode or not.
Defaults to false
editableOn EditableType
Specifies the event action of input to enter edit mode instead of using edit icon. The possible values are:
-
Click: Do the single click action on input to enter into the edit mode. -
DblClick: Do the single double click action on input to enter into the edit mode. -
EditIconClick: Disables the editing of event action of input and allows user to edit only through edit icon.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
cancelButton : { iconCss: 'e-icons e-cancel-icon' }
});
editObj.appendTo('#inplace_editor');Defaults to ‘Click’
emptyText string
Sets the text to be shown when an element has ‘Empty’ value.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
cancelButton : { iconCss: 'e-icons e-cancel-icon' }
});
editObj.appendTo('#inplace_editor');Defaults to ‘Empty’
enableEditMode boolean
Specifies to show/hide the editing mode.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
cancelButton : { iconCss: 'e-icons e-cancel-icon' }
});
editObj.appendTo('#inplace_editor');Defaults to false
enableHtmlParse boolean
It enables or disables the parsing of HTML string content into HTML DOM elements for In-place Editor.
If the value of the property is set to false, the In-place Editor value will be displayed as HTML string instead of HTML DOM elements.
Defaults to true
enableHtmlSanitizer boolean
Defines whether to allow the cross-scripting site or not.
Defaults to true
enablePersistence boolean
Enable or disable persisting component’s state between page reloads. If enabled, following list of states will be persisted.
- value
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
cancelButton : { iconCss: 'e-icons e-cancel-icon' }
});
editObj.appendTo('#inplace_editor');Defaults to false
enableRtl boolean
Enable or disable rendering component in right to left direction.
Defaults to false
locale string
Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.
Defaults to ’’
mode RenderMode
Specifies the mode to be render while editing. The possible modes are :
-
Inline: Editable content is displayed as inline text and ok/cancel buttons are displayed at right bottom corner of input. -
Popup: Editable content and ok/cancel buttons are displayed inside popup while editing.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
mode : 'Inline'
});
editObj.appendTo('#inplace_editor');Defaults to ‘Popup’
model AutoCompleteModel|ColorPickerModel|ComboBoxModel|DatePickerModel|DateRangePickerModel|DateTimePickerModel|DropDownListModel|MaskedTextBoxModel|MultiSelectModel|NumericTextBoxModel|RichTextEditorModel|SliderModel|TextBoxModel|TimePickerModel
Specifies the model object configuration for the integrated components like AutoComplete, DatePicker,NumericTextBox, etc.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
type: "Text",
model: { placeholder: "Enter employee name" }
});
editObj.appendTo('#inplace_editor');Defaults to null
name string
Specifies the name of the field which is used to map data to the server.
If name is not given, then component ID is taken as mapping field name.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
name: 'Editor',
});
editObj.appendTo('#inplace_editor');Defaults to ’’
popupSettings PopupSettingsModel
Specifies the object to customize popup display settings like positions, animation etc.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
popupSettings: {
model: { width: 'auto' }
},
});
editObj.appendTo('#inplace_editor');Defaults to {}
primaryKey string|number
Defines the unique primary key of editable field which can be used for saving data in data-base.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
primaryKey: '',
});
editObj.appendTo('#inplace_editor');Defaults to ’’
saveButton ButtonModel
Used to customize the “Save” button UI appearance by defining Button model configuration.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
savebutton : { iconCss: 'e-icons e-save-icon' }
});
editObj.appendTo('#inplace_editor');Defaults to { iconCss: ‘e-icons e-save-icon’ }
showButtons boolean
Used to show/hide the ok/cancel buttons of In-place editor.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
showButtons : true
});
editObj.appendTo('#inplace_editor');Defaults to true
submitOnEnter boolean
Sets to trigger the submit action with enter key pressing of input.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
submitOnEnter : true
});
editObj.appendTo('#inplace_editor');Defaults to true
template string|HTMLElement|Function
Specifies the HTML element ID as a string that can be added as a editable field.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
template : '<p>editable text</p>'
});
editObj.appendTo('#inplace_editor');Defaults to ’’
textOption textOptionType
Specifies the option to be set on initial rendering. It is applicable for DropDownList,
AutoComplete, ComboBox, and MultiSelect component types.
The possible options are:
-
Never: The corresponding field value will never be set initially in the component. -
Always: The corresponding field value will be set initially in the component.
Defaults to ‘Never’
type InputType
Specifies the type of components that integrated with In-place editor to make it as editable.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
type : 'Text'
});
editObj.appendTo('#inplace_editor');Defaults to ‘Text’
url string
Gets the url for server submit action.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
url : 'https://ej2services.syncfusion.com/production/web-services/api/Editor/UpdateData'
});
editObj.appendTo('#inplace_editor');Defaults to ’’
validationRules { : }
Maps the validation rules for the input.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
name: "Today",
validationRules: {
Today: { required: true }
}
});
editObj.appendTo('#inplace_editor');Defaults to null
value string|number|Date|string[]|Date[]|number[]
Specifies the display value for input when original input value is empty.
<div id="inplace_editor"></div>import { InPlaceEditor } from '@syncfusion/ej2-inplace-editor';
let editObj: InPlaceEditor = new InPlaceEditor({
value: 'Editor'
});
editObj.appendTo('#inplace_editor');Defaults to null
Methods
addEventListener
Adds the handler to the given event listener.
| Parameter | Type | Description |
|---|---|---|
| eventName | string |
A String that specifies the name of the event |
| handler | Function |
Specifies the call to run when the event occurs. |
Returns void
appendTo
Appends the control within the given HTML element
| Parameter | Type | Description |
|---|---|---|
| selector (optional) |
string | HTMLElement
|
Target element where control needs to be appended |
Returns void
attachUnloadEvent
Adding unload event to persist data when enable persistence true
Returns void
dataBind
When invoked, applies the pending property changes immediately to the component.
Returns void
destroy
Removes the control from the DOM and also removes all its related events.
Returns void
detachUnloadEvent
Removing unload event to persist data when enable persistence true
Returns void
getLocalData
Returns the persistence data for component
Returns any
getRootElement
Returns the route element of the component
Returns HTMLElement
handleUnload
Handling unload event to persist data when enable persistence true
Returns void
refresh
Applies all the pending property changes and render the component again.
Returns void
removeEventListener
Removes the handler from the given event listener.
| Parameter | Type | Description |
|---|---|---|
| eventName | string |
A String that specifies the name of the event to remove |
| handler | Function |
Specifies the function to remove |
Returns void
save
Submit the edited input value to the server.
Returns void
validate
Validate current editor value.
Returns void
Inject
Dynamically injects the required modules to the component.
| Parameter | Type | Description |
|---|---|---|
| moduleList | Function[] |
? |
Returns void
Events
actionBegin EmitType<ActionBeginEventArgs>
The event will be fired before the data submitted to the server.
actionFailure EmitType<ActionEventArgs>
The event will be fired when data submission failed.
actionSuccess EmitType<ActionEventArgs>
The event will be fired when data submitted successfully to the server.
beforeSanitizeHtml EmitType<BeforeSanitizeHtmlArgs>
Event triggers before sanitize the value.
beginEdit EmitType<BeginEditEventArgs>
The event will be fired before changing the mode from default to edit mode.
cancelClick EmitType<MouseEvent>
Event triggers when click the cancel button.
change EmitType<ChangeEventArgs>
The event will be fired when the integrated component value has changed that render based on the type property
in the In-place editor.
created EmitType<Event>
The event will be fired once the component rendering is completed.
destroyed EmitType<Event>
The event will be fired when the component gets destroyed.
endEdit EmitType<EndEditEventArgs>
The event will be fired when the edit action is finished and begin to submit/cancel the current value.
submitClick EmitType<MouseEvent>
Event triggers when click the submit button.
validating EmitType<ValidateEventArgs>
The event will be fired while validating current value.