Hi,
I have a grid where I need to validate for duplicate records. I have used two for loops, the first loop gets the modified records and compares with the store.
The problem is even the store is having newly added record before committing.
Any ideas on how to avoid duplicate records is appreciated.
{text:'Save',
tooltip:'Save',
iconCls:'save',
id: 'save',
disabled :true,
handler: function(){
var mrecords=dropDownGridStore.getModifiedRecords();
var flag = false;
var duplicateFlag = false;
var store = dropDownGrid.getStore();
var size = store.getCount();
var record = store.getAt(cnt);
var dropdownvalue1 = "";
//Validating for blank record
for(var count=0;count
var dropDownVal=mrecords[count].get('dropDownValues');
dropDownVal=dropDownVal.replace(/^ss*/, '').replace(/ss*$/, ''); Electronic Code of Federal Regulations::: Appendix A to Subpart E of Part 763—Interim Transmission (a) Records required under this section shall be maintained in a centralized location in the http://ecfr.gpoaccess.gov/cgi/t/text/text-idx?c=ecfr&rgn=dde=40:30.0.1.1.18&idno=40HOME | Subscribe / Unsubscribe to a Mailing List - FlashDen:: Advanced email validation. Restricts duplicate email entry. Sends HTML I believe you can also restrict duplicate records on the mySQL side as well, if http://flashden.net/item/subscribe-unsubscribe-to-a-mailing-list/14567ref=fisch79HOME |
if(dropDownVal==''){ comp.databases.ms-access [Archive] - dbTalk Databases Forums:: Use of Max in query grid (2 replies) Run as is it possible ? Summarizing values for duplicate records (1 replies) Function to count workdays (18 replies) http://www.dbtalk.net/archive/77-2005-8-1.phpHOME | Access Tips:: One way to delete duplicate records in Access is to create a new table which Using Validation Rules to Restrict Data in Microsoft Access http://www.createthefuture.com/access.htmHOME |
Ext.MessageBox.alert('Error','Blank value is not allowed. Please enter a dropdown value.');
flag = true;
break;
}
//Validate for Duplicate records
for(var cnt=0;cnt
record = store.getAt(cnt)
dropdownvalue1 = record.get('dropDownValues');
dropdownvalue1=dropdownvalue1.replace(/^ss*/, '').replace(/ss*$/, '');
if(dropDownVal.toLowerCase()==dropdownvalue1.toLow erCase()){
duplicateFlag=true;
Ext.MessageBox.alert('Error','You have entered Dropdown Value "'+dropdownvalue1+'" which already exists in the list. Duplicate values are not allowed');
break;
}
}
}
if(!flag && !duplicateFlag){
var jsonData = updateDB(mrecords);
Ext.Ajax.request({
url: 'saveDropDownData.action',
params: {jData:jsonData,codeType:dropDownName.getValue()},
waitMsg:'Saving...',
success: function(response, request){
var result = Ext.decode(response.responseText);
if(result.success=='true'){
Ext.MessageBox.hide();
Ext.MessageBox.show({
title: 'Save',
msg: "Your data changes have been saved successfully.",
buttons: Ext.Msg.OK,
closable:false,
animEl: 'elId',
icon: Ext.MessageBox.INFO
});
//Modified to store the node list to dropdown
dropDownGridStore.commitChanges();
dropDownGridStore.load({
params: {'moduleName': moduleNames.getValue(),'codeType':dropDownName.get Value()}
});
} else {
Ext.MessageBox.show({
title: 'Error',
msg: "Error in saving the records. " + result.msg,
buttons: Ext.Msg.OK,
closable:false,
animEl: 'elId',
icon: Ext.MessageBox.INFO
});
}
}
});
}
}
}
Regards,
SURESH
i just loop through the store and look for a specific value like an ID or something.
How much does getting a small tattoo on your hip/stomach hurt?
Do anyone else have an itchy anus? ?
|