export class Editing extends SampleBase {
constructor() {
super(...arguments);
this.toolbarOptions = ['Add', 'Edit','Update', 'Delete'];
this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true,};
this.validationRules = { required: true };
this.orderidRules = { required: true, number: true };
this.pageSettings = { pageCount: 5 };
this.customerIDRules = {
minLength: [this.customFn, 'Need atleast 5 letters'],
required: true
};
}
customFn(args) {
var editRow = parentsUntil (args.element, 'e-row'); //here you can get the values the other input field value
return getValue('value', args).length >= 5;
};
render() {
return (<div className='control-pane'>
<div className='control-section'>
. . .
<ColumnDirective field='CustomerName' headerText='Customer Name' width='150' validationRules={this.customerIDRules}></ColumnDirective>
. . .
</GridComponent>
</div>
</div>);
}
}
render(<Editing />, document.getElementById('sample')); |
customFn(args) {
var editRow = parentsUntil (args.element, 'e-row'); //here you can get the values the other input field value
var Grid_Id = parentsUntil (args.element, 'e-grid').id;
console.log(editRow.querySelector("#"+Grid_Id+"OrderID").value);
return getValue('value', args).length >= 5;
}; |