Opened 7 years ago

Closed 6 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 7 years ago by Ed Chatelain

Hi itamar, I am not sure I understand the problem. Could you provide a testcase to show me what you mean?

comment:2 Changed 7 years ago by Martin Minka

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.

Last edited 7 years ago by Martin Minka (previous) (diff)

comment:3 Changed 6 years ago by Ed Chatelain

Resolution: invalid
Status: newclosed

No testcase was provided.

Note: See TracTickets for help on using tickets.