I have a grid bound to a form the forms submit action is to update the loaded record if there is one and add a new record if its a blank form. but if I select a record first and then call
myGrid.getSelectionModel().deselectAll();
myform.getForm().reset();
to clear the form so I can add a new record it overwrites the previously selected record with an update.
record = myform.getRecord();
if(record){
record.set(values);
}
shouldn’t myform.getRecord(); be null after a reset? how do I clear the record selection?
In short, no, it shouldn’t and you don’t have legal approaches to clear the record after the first time you load anything via
loadRecord.Although, you could still do
myform.getForm()._record = nullassignment, I would strongly object against that, as it may break some internal functionality by ExtJS.Here is an extract from ExtJS API:
And it does exactly that, returns the last record loaded via
loadRecord.Here are some sources:
Actually, those are the only methods of
Ext.form.Basic(an instance of which is returned bygetForm()) dealing withthis._recordfield.As for reset
As you could see, reset has nothing to do with the record returned by
getRecord(), it’s just resetting field values.