I can't say expert, but I've used it enough to comment.  Preferably, the
view would take care of itself'; concerning the state of the view
(buttons).  With the collection in the model. bound to the DataGrid's
dataProvider, dispatch a ChangeFilterEvent (type:String).  Assuming that
you already have the data in the collection, apply filterFunctions to
the collection in the ChangeFilterCommand (or whatever you want to call
it),  Don't forget to refresh the collection after you apply a sort or
fiterFunction;  Since the DataGrid's dataProvider is bound to the
collection, the DataGrid view will update automatically.    If you need
to know the state of the view in other parts of the application, you can
always create bound state variables in the model; and control the view
state that way.  but, if you don't need them, don't use them.

-TH

--- In [email protected], "O. Frabjous-Dey"
<[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
>
> Here's a design question for you Cairngorm experts.
>
> In my application's view, I have two main subcomponents: a control bar
sort
> of custom component that I wrote that we'll call the
FrabjousControlBar, and
> a DataGrid, which lists all the users in my application. These users
are
> either Administrators or Members.
>
> The FrabjousControlBar contains two checkboxes: a checkbox labeled
"Show
> Administrators" and a checkbox labeled "Show Members". Both are
checked by
> default, but when "Show Administrators" is unchecked, the DataGrid
removes
> all of the Administrators. Something similar happens for "Show
Members".
>
> I'm having trouble choosing the correct implementation for this. There
are
> two ways I can see to do this:
>
> 1) When a user unchecks "Show Administrators," the control kicks off a
> Cairngorm Event, the controller executes a Command that changes a
boolean
> flag in the ModelLocator, and the DataGrid responds to the change on
that
> flag.
>
> 2) Since the user interaction affects the view only, no MVC round trip
> occurs. My view knows when the box is unchecked and updates the
DataGrid
> accordingly.
>
> Which is better? 1) is more pleasingly MVC, but comes with a lot of
> overhead and additional effort.
>
> Thanks,
> O.
>



Reply via email to