I have a grid data and I push new data to him. The new data must contain at least one value to be different.
I've try this:
vm.checkUnique = function () {
var gridData = vm.sanctionReferencesGridOptions.data;
var formData = vm.editableGrid.newRowForm;
for (var i = 0; i < gridData.length; i++) {
var rowData = gridData[i]
for (var key in rowData) {
console.log('rowData: ' + key);
for (var formKey in formData) {
console.log('formKey: ' + formKey);
}
}
}
}
vm.sanctionReferencesGridOptions.data = [
{
"code": 1111,
"listName": "List 1",
"sinceDate": "2017-08-23",
"endDate": "2017-08-23"
}, {
"code": 2222,
"listName": "List 2",
"sinceDate": "2017-08-23",
"endDate": "2017-08-23"
}
]
vm.editableGrid.newRowForm = {
code: "1111",
listName: "List 1",
sinceDate: "2017-08-23",
endDate: "2017-08-23"
}
So in this example I must show an error message with duplicated row data..
Thanks for any help!