Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought

Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Author Topic: PureMVC notification or Flash Event?  (Read 8674 times)
Full Member
Posts: 21

View Profile Email
« on: July 06, 2010, 02:05:47 »

This is probably a easy one but.. i am confused all of a sudden about how I should handle this scenario.  I have a UserManager component that is similar to the EmployeeAdminDemo.  Basically the view component has a mode property that controls weather certain buttons, fields are displayed and enabled.  If a user is editing his own profile then certain controls like, userID, status and role should be disabled.  Also, if a user is an admin or super user then they will have access to certain controls that a regular user will not have.  Should I be managing this property and the responses to its changes using the custom event way or should I use the PureMVC communication system to send notifications to the view component's mediator?  Or does this even make a difference?

Global Moderator
Hero Member
Posts: 2871

View Profile WWW Email
« Reply #1 on: July 07, 2010, 01:52:24 »

What I usually do is have the view component use binding expressions on the individual controls to manage their visibility or enablement. Or if there is a significant amount of binding going on (5 or more controls need to be hidden or shown according to a single expression), I'll instead use a view state that is controlled by binding.

So essentially, the view component can be intelligent enough to configure itself properly based on the data it is given. This, IMHO, is better than having another actor (like a mediator) puppet a dumb view component. The view component has no other reason to exist than to expose the data for view and/or manipulation, so it's going to have to know the data somewhat.

« Last Edit: July 09, 2010, 12:29:30 by puremvc » Logged
Pages: [1]