Refreshing the object view on domain model object property changes

May 13, 2013 at 6:26 AM
Hi Guys,
          I know that NO has the ability to show ViewModels which is great but does NO have the ability to rebind a model to its view or refresh the view when the model is changed but not persisted or updated. Would it be easy for NO to just have a method on an domain object to just Rebind() or Refresh() which would just re draw the object display which could be called as required when a property was changed?
Regards,
            Alistair
Coordinator
May 13, 2013 at 8:30 AM
There is a Refresh() method on the Container, which will cause a domain object to refresh its values from the database (or cache). You can easily write a user action on a domain object that just calls this method. The user can hit this action to refresh the view.

But Naked Objects MVC is not a 'push' architecture. If you want a screen to refresh when something else (other than the current user) has changed the state of an object, then the simplest option is probably to have a JavaScript on a custom page for that object that periodically calls a Refresh action.

Writing a true 'push' architecture would be a much bigger effort and I would not recommend attempting anything like that until you had become very fluent in Naked Objects.
May 13, 2013 at 9:40 AM
Edited May 13, 2013 at 9:40 AM
Writing a true 'push' architecture would be a much bigger effort and I would not recommend attempting anything like that until you had become very fluent in Naked Objects.
True, although SignalR makes it a lot easier than it used to be.