Fire-Dragon-DoL
19 Jun 2012, 8:50 AM
I've created on my view a changepassword function that actually performs an ajax call to change the password of the selected user.
Now this is only a question about correct programming style, because I don't have any issue, however I'm interested in understanding how should I do this:
On the controller, I get the click event fired. At this point, I need to open a Ext.Msg.prompt to let the user insert the password and then run a function that basically run an Ext.Ajax call with correct parameters.
Currently, I did everything "view side" except click event detection, which simply fires the changePassword method on the view with the correct parameter (a record).
However I'm thinking about changing the code in this way:
changePassword method accepts a function as another parameter that is on the controller and will perform an ajax call. In this way, the ajax call will stay on the controller while the Msg.prompt on the view. Is this a better way to follow mvc pattern?
Now this is only a question about correct programming style, because I don't have any issue, however I'm interested in understanding how should I do this:
On the controller, I get the click event fired. At this point, I need to open a Ext.Msg.prompt to let the user insert the password and then run a function that basically run an Ext.Ajax call with correct parameters.
Currently, I did everything "view side" except click event detection, which simply fires the changePassword method on the view with the correct parameter (a record).
However I'm thinking about changing the code in this way:
changePassword method accepts a function as another parameter that is on the controller and will perform an ajax call. In this way, the ajax call will stay on the controller while the Msg.prompt on the view. Is this a better way to follow mvc pattern?