In Slickgrid inline edit, we try to validate the data based on some criteria. But criteria check need some modified or existing data from database. so before validate will fetch the criteria needed data from database. This data fetch process is async process. After this async process completion will given the data validate status. Based on that validation status our custom validation should works. As we expected.
So this scenario we tried the following code blocks. But it is not working as our expectation. Because async process is not available in custom validator.
column definition:
[{
id:'project_name',
nameKey:'Project Name',
field:'project_name',
sortable: true,
type: FieldType.string,
filterable: true,
filter: {
model: Filters.compoundInput
},
cssClass: 'left-align',
editor: {
model: Editors.longText,
validator: ProjectValidator
}
}]
Custom Validation Menthod:
ProjectValidator = (value: any, args?: EditorArguments) => {
let queryTerm = value;
return this.queryProjects(queryTerm).then(response=>{ // Checking the project name exist in database
if(response['status']=='ALREADY_EXIST'){
return { valid: false, msg: 'Entered project name existing in database. Please enter unique project.' };
}
return { valid: true, msg: '' };
})
}
So kindly guide me to achieve this async custom validation in slickgrid inline edit feature.