|
App.component.ts
export class AppComponent {
@ViewChild('ddsample')
public dropDown: DropDownListComponent;
public data: Object[];
public editSettings: Object;
public toolbar: string[];
public formatoptions: Object;
public checkboxval: any;
public customFn: (args: { [key: string]: string }) => boolean = (args: { [key: string]: string }) => {
const currentVal:string = (args.element as any).ej2_instances[0].checked; //use this checked property from checkbox instance to get the current state of checkbox
return true;
}
public ngOnInit(): void {
this.pageSettings = { pageCount: 5 };
this.formatoptions = { type: 'dateTime', format: 'M/d/y hh:mm a' }
this.checkboxval = { minLength: [this.customFn, 'Checkbox validation'] }
}
} |
|
App.component.html
<ejs-grid #normalgrid id='Normalgrid' [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings' [toolbar]='toolbar'>
<e-columns>
. . . . . . .
<e-column field='Status' textAlign='Left' [validationRules]='checkboxval' type="boolean" displayAsCheckBox='true' editType ="booleanedit" width='60' ></e-column>
. . . . . . .
</e-columns>
</ejs-grid>
|