Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
450
Unable to display error message for duplicate values in iggrid
posted

Hi Team,

I am doing a custom validation for a particular column (BILL_NB) in iggrid .I am able to do the validation but error message (highlighted in yellow) is not displaying in UI . How to display the below error message in UI ,if data is duplicate ?

validatorOptions: {
required: {
errorMessage: "The Bill Number may not be blank."
},
lengthRange: {
max: 20,
errorMessage: "Only 20 characters are allowed"
},

custom: {
method: function (value,options) {
var rows = $("#Pymtgrid").igGrid("rows");
for (var i = 0; i < rows.length; i++) {
var currentRow = rows[i];
var currentValue = $("#Pymtgrid").igGrid("getCellValue", $(currentRow).attr("data-id"), "BILL_NB");

if (value === currentValue && $(currentRow).find(".ui-iggrid-editingcell").length === 0) {

errorMessage: "Duplicate";

return false;
}
}
return true;
}

}

}
}

Parents
  • 1080
    Verified Answer
    Offline posted

    Hello,

    Thank you for posting in our community.

    The errorMessage has to be a property of the custom object:

    custom: {
    	method: function (value, options) {
    		var rows = $("#Pymtgrid").igGrid("rows");
    		for (var i = 0; i < rows.length; i++) {
    			var currentRow = rows[i];
    			var currentValue = $("#Pymtgrid").igGrid("getCellValue", $(currentRow).attr("data-id"), "BILL_NB");
    			if (value === currentValue && $(currentRow).find(".ui-iggrid-editingcell").length === 0) {
    				return false;
    			}
    		}
    		return true;
    	},
    	errorMessage: "Duplicate"
    }

    I have created and attached a small sample for your reference. Please test this sample on your side and let me know whether it resolves your issue.

    2642.Sample.zip

Reply Children
No Data