Posted 18 June 2020, 3:56 am EST
Hi,
I am creating a separate JS file in vue to validation of grid cell values.
So I am using getError method of grid collection.
Now I faced some issue with this.
- It is render all column on every change and I want only for activeEditor cell.
- cell should allow to edit other cell also while current cell have wrong value , means user should not restrict to put write values.
Here is my code
this.grid.collectionView.getError = function(item, prop,s) {
console.log(item);
switch (prop) {
case ‘planType’:
break;
case ‘planName’:
if(item.planName.length > 100){
return “Plan Name should not exceed 200 Characters”;
}
break;
case ‘planID’:
if(item.planID.length > 50){
return “Plan ID should not exceed 200 Characters”;
}
break;
case ‘ECS_ID’:
if(isNaN(parseFloat(item.ECS_ID)) && isFinite(item.ECS_ID)){
return “ECS Id should be number”;
}
break;
case ‘conversion’:
if(item.conversion == “”){
return “Conversion field at Plan Level should be Null or >0.”
}
break;
case ‘trancheExist’:
break;
case ‘analystComment’:
if(item.analystComment.length > 100){
return “Message should trigger when Analyst comment at Plan Level exceeds 500 characters.”;
}
break;
case ‘Oustanding’:
if (item.Oustanding < 0) {
return ‘Outstanding at the end of the period should not be < 0’;
}
break;
case 'transactions.downloads': if (item.transactions.downloads < 0) { return 'Downloads cannot be negative'; } break; case 'transactions.sales': if (item.transactions.sales < 0) { return 'Sales cannot be negative'; } break; case 'transactions.expenses': if (item.transactions.expenses < 0) { return 'Expenses cannot be negative'; } break; } return null; // no errors }
Regards
Deepak Dubey