Sorry, my bad English. Should be Stefan. -TH
--- In flexcoders@yahoogroups.com, "Tim Hoff" <[EMAIL PROTECTED]> wrote: > > Hi Stephan, > > Don't worry about good/bad English here, communication is the key. > The beauty of Cairngorm and Flex is that you can accomplish the same > thing several ways. Chances are that your edit/delete form is a > view also. So you can either change view state (ModelLocator) to > add the view child, or create a PopUp with the view as the child. > Either way works, but PopUps add a level of event processing that > can be tricky. > > To answer your question, the Cairngorm pundits would recommend that > the DataGrid's selected event should trigger a Command that updates > a ModelLocator state variable, and selected item, to display the > form. That's one way. Or you can launch a PopUp from the command > itself. > > Another approach is to not worry about the view knowing about the > model. I mean it's bound one way, why not the other. Every bound > view knows about the ModelLocator. So it makes sense, since a view > has a hard coded variable name for state, that you can also directly > change a ModelLocator variable from the view. Total encapsulation > or limited encapsulation? > > Just make sure that you keep the data in the model. What you choose > beyond that is apparently up to you. I personally like the PopUp > approach. From the view, it's quicker and valid for local > processing. But, the Command/ModelLocator approach is considered > more stable .02 > > -TH > > --- In flexcoders@yahoogroups.com, "Stefan Schmalhaus" <stefan@> > wrote: > > > > I've done some research on this list but haven't found any valid > > information on what's considered best pratice in dealing with popup > > windows. The few Cairngorm sample apps that are around don't seem > to > > use the TitleWindow component at all. > > > > Let's say I have a simple DataGrid populated with some user data. > If I > > click on a row in the DataGrid a popup window opens with a form for > > editing the user information. The popup window also has two buttons > > for deleting or saving (updating) the user account. > > > > I have done stuff like this several times in Flash/AS2 but I've > never > > used a framework approach so far. Now, if I look at this rather > simple > > task from a Cairngorm perspective it doesn't seem to be that simple > > any more. (But I guess that's because I'm not yet too familiar with > > Cairngorm.) I know how to establish databinding between the data > > provider and {model.users} and all this basic Cairngorm stuff. > > > > But what happens when a row is clicked? I'm not even sure if I'm > > supposed to treat this event as a single event ("selectUser" or > > "openPopup"?) or as a chain of two events ("selectUser" -> > > "openPopup"). Since my user information is organized as an array of > > value objects it's easy to assign the selected user VO to > > model.selectedUser: > > > > model.selectedUser = UserVO(userList.selectedItem); > > > > But am I "allowed" to directly access the ModelLocator from my view > > component? Or am I supposed to route this simple action through the > > Cairngorm "command chain" (Cairngorm Event -> Front Controller -> > > Command Class -> ModelLocator)? > > > > Next question, what about the popup itself? Can I simply use > > PopUpManager.createPopUp( this, UserFormView , true)? Or am I > supposed > > to treat this as a Cairngorm Event, too? > > > > I feel in "safe Cairngorm terrain" again with the "updateUser" and > > "deleteUser" actions on the buttons. But what about closing the > popup > > window? Is this even worth a Cairngorm event? > > > > I guess these questions sound rather stupid to those of you who are > > more experienced with frameworks. But at the moment these questions > > are obstacles on my way to master Cairngorm (which I will > hopefully do > > one day). I apologize for my verbose post and my bad English, but I > > hope that someone can shed some light on these issues. > > > > Stefan > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/