I am using syncfusion ejs-grid in angular . Whenever user editing the row and make the mandatory textbox as empty and click on save (or outside of the grid) the Validation error message is displaying .
<ejs-grid
#normalgrid
id="Normalgrid"
[dataSource]="data"
allowPaging="true"
[pageSettings]="pageSettings"
height="100"
[editSettings]="editSettings"
[toolbar]="toolbar"
>
<e-columns>
……………….. </e-columns>
</ejs-grid> |
Hi Praveenkumar,
Query1: “How to set AutoFocus to the specific cell input which is mandatory in that row on the grid?”
My scenario is like, I am editing a row(Inline editing) in grid, and clear\empty the text in mandatory field textbox, then click on Save button (or outside of grid), then it shows the validation error message but I need it to be auto focus on the required textbox field (screenshot below).
Query2: “Also, I didn't set the height to the grid. First row is getting disappeared / truncated when user tries to add a record for the first time and clicks outside the fields without entering Field values”
Thanks
Nambi R
actionComplete(args) { //grid’s actionComplete event
if (args.requestType == 'beginEdit' || args.requestType == 'add') {
var form = args.form.ej2_instances[0]; //form validator
form.validationComplete = function(args) { //form validator’s validationComplete event
if (args.status == 'failure' &&!args.element.parentElement.classList.contains('e-input-focus')) {
args.element.parentElement.classList.add('e-input-focus'); //add highlight/focus class to the column cell element when validation status is failure
if ( args.errorElement.parentElement.parentElement.style.display =='none') {
args.errorElement.parentElement.parentElement.style.display = ''; // here we show the error message tooltip if it is not shown
}
} else if (args.status == 'success' && args.element.parentElement.classList.contains('e-input-focus')) {
args.element.parentElement.classList.remove('e-input-focus'); // remove that highlight/focus class to the column cell element when validation status is success
var vError= args.element.closest('form').querySelectorAll('.e-griderror');
for (var i = 0; i < vError.length; i++) {
if (vError [i].id == args.inputName + '_Error') {
vError [i].style.display = 'none'; // here we hide the error message tooltip if it is not hide
}
}
}
};
}
} |
<ejs-grid
#normalgrid
id="Normalgrid"
[dataSource]="data"
allowPaging="true"
[pageSettings]="pageSettings"
height="100"
[editSettings]="editSettings"
[toolbar]="toolbar"
>
<e-columns>
……………….. </e-columns>
</ejs-grid> |
dataBound(){
var rowCount=this.grid.pagerModule.pagerObj.totalRecordsCount;
console.log(rowCount)
} |