Opened 9 years ago
Closed 8 years ago
#16109 closed defect (invalid)
Model objects with business logic can't be used with EditModelRefController
Reported by: | itamar | Owned by: | Ed Chatelain |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | DojoX MVC | Version: | 1.8.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Let's assume I am using a model object with some simple business logic inside it, for instance an isValid() method, and I'd like to use EditModelRefController? to manage this model object.
Since EditModelRefController?.reset() uses cloneModel() internally, a call to reset() results in a new object managed by the EditModelRefController? instance - where this new data object indeed has the same data fields as the original - but one that does not contain the isValid() method. This causes any controller code which relies on such business methods to malfunction.
I'm not yet sure what would be the most appropriate way to handle this in practice, but I think it's a very real concern when implementing apps.
Change History (3)
comment:1 Changed 9 years ago by
comment:2 Changed 8 years ago by
itamar, I was not able to prove that method showMyText() would ever be removed from EditModelRefController? after reset(). Here is my test http://jsfiddle.net/bigm/TKZ76/1/. When you press "Test removal of showMyText()" button the method will be removed and you will see this information in output.
But I think that EditModelRefController? with holdModelUntilCommit=true
behaves too inconsistent compared to
holdModelUntilCommit=false
.
I hope that Ed will review my example and decide what to do about it.
comment:3 Changed 8 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
No testcase was provided.
Hi itamar, I am not sure I understand the problem. Could you provide a testcase to show me what you mean?