Having trouble getting help?
Contact Support
Contact Support
Custom indication in Angular Inplace editor component
27 Apr 20242 minutes to read
You can add custom indication to unsaved input value by using the actionSuccess event, when data not submitted to the server.
In this sample, the actionSuccess
event configured and the URL property not included. Then submit button clicked, the current editor value saved into input and data sending to server action prevented due to the URL
property not configured.
But actionSuccess
event will trigger the handler function with null
argument values. In handler function data property primaryKey value checked, whether it empty or not. If it is empty custom class, added in the e-value-wrapper
element to customize its styles.
To send input value to local, set the
URL
property as empty.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { InPlaceEditorAllModule } from '@syncfusion/ej2-angular-inplace-editor'
import { Component } from '@angular/core';
import { InPlaceEditorComponent, ActionEventArgs } from '@syncfusion/ej2-angular-inplace-editor';
import { isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
@Component({
imports: [
InPlaceEditorAllModule
],
standalone: true,
selector: 'app-root',
template: `
<div id='container'>
<span class="content-title"> Enter your name: </span>
<ejs-inplaceeditor #element id="element" mode="Inline" value="Andrew" [model]="model" (actionSuccess)="actionSuccess($event)"></ejs-inplaceeditor>
</div>
`
})
export class AppComponent {
public model: object = { placeholder: 'Enter some text' };
public actionSuccess(e: ActionEventArgs | any): void {
let pk: string = e.data['PrimaryKey'];
if (isNOU(pk) || pk === '') {
(document.querySelector('.e-editable-value') as Element).classList.add('e-send-error');
}
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));