I have the following code which I got directly from a tutorial in ExtJs:
updateUser: function (button) {
var win = button.up('window'),
form = win.down('form'),
record = form.getRecord(),
values = form.getValues();
record.set(values);
win.close();
Now, I am working on some modifications to suit my needs, what exactly do the following 3 lines return:
form = win.down('form'),
record = form.getRecord(),
values = form.getValues();
According to the documentation, the down() method above returns an Ext.Container.AbstractContainer that should not even be used according to the documentation. Furthermore, it does not have a getRecord() or a getValues() method. Can anyone explain what is going on here and what kind of objects those 2 calls return?
When you call
upit looks for the ancestor of selector passed. When you calldownit returns the descendant of the selector passed.form.getRecord()returns the model instance of the form. andform.getValues()returns the actual values entered in the form.Ex: Model has 3 fields
id, name, emailand some config when you callform.getRecord()it returns the model instance, basically skeleton.Where as
form.getValues()returns the values entered.Ex: If the following values are entered in the form
id=1, name=xxxxx, email=aaaaa@test.comwhen you call
form.getValues()it returns an objectI hope this answers you question