I would like to clarify how do ext 4 models correlate to form panels. Suppose I have a model, e.g. "User", which has a REST proxy attached.When I want to modify user parameters, i use form's
loadRecord( Ext.data.Model record ) : Ext.form.Basic
method, to set form's field values.After modification, I call "updateRecord" method, to send changes from form to loaded model, and then use model's "save" method, to send changes to server. This works quite well, and seems to fit Ext MVC concepts.
But, the question is: how should I conform to MVC, in case I need to upload file, while modifying user's data (e.g. avatar). According to what I learned from docs, I should switch to using form's "submit" method to send updated data so server, including the file.In this case, I see several drawbacks:
- The original model, loaded to the form, will not be updated.
- If I update the model (using "updateRecord", or other way), the model will stay in dirty state, however, changes have already been sent to server.
- The same proxy configuration should be applied to form, as to model, so that I would not need to change server side.
Is this a correct way of implementing file-upload through ext forms? Is there any way to do this using model.save method, to be more MVC-stylish?