Hi, I have a created a default model and when I start my application, I want to copy it to a second model and then use it in a different function to reset everything. Here what I have done, on my InitFunction:
console.log("Data ", data);
copyModel = $.extend({}, data);
Data is my original model. I have declared the copyModel as a global variable.
Then I have the resetFunction:
resetP: function(){
this.getView().setModel(new JSONModel(copyModel));
console.log("CopyModel ", copyModel);
}
The code seems to run, but I have a weird problem. When I first click the reset Button, copyModel is same with the original model (data). The second time I ran the resetFunction, copyModel is not the same with the original. It has been overwritten with the existing one the moment I press the button. Can anyone help me with that? Thank you!
Request clarification before answering.
Unfortunately, none of these two ways worked. As it's written on Stackoverflow and works for me:
resetP: function(){
this.getView().getModel().updateBindings();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.