Re: [flexcoders] View States Vs using the visible flag with multiple UI components..
I think the choice really depends on the usage of your application. If the known list of state combinations is pre-determined I usually do this type of thing using view states. As an example, if I have a component that has 4 grids in a VBox and the known states are State 1: 1 and 2 visible, 3 and 4 invisible State 2: 3 and 4 visible, 1 and 2 invisible State 3: All visible State 4: None visible However, if I have the same grids and the user can interactively set which are visible and not visible I find it easier to simply set the visible and includeInLayout properties of the grids directly without the use of view states. hth Scott Scott Melby Founder, Fast Lane Software LLC http://www.fastlanesw.com http://blog.fastlanesw.com sk_acura wrote: Hi All, I am trying to display multiple DataGrids in a Panel. User will have the option of switching between DataGrids. What's the advantages of having one DataGrid with multiple states (if that is possible).. I am planning to do it by defining one DataGrid ( as the Structure of these data grids are different) for each of my views and showing and hiding them depending on user selection. Could some one point out the pros cons of each approach.. Thanks Mars
RE: [flexcoders] View States Vs using the visible flag with multiple UI components..
Two additional possibilites are 1) use a ViewStack and 2) dynamically build the DataGrid. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Scott Melby Sent: Tuesday, April 15, 2008 10:57 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] View States Vs using the visible flag with multiple UI components.. I think the choice really depends on the usage of your application. If the known list of state combinations is pre-determined I usually do this type of thing using view states. As an example, if I have a component that has 4 grids in a VBox and the known states are State 1: 1 and 2 visible, 3 and 4 invisible State 2: 3 and 4 visible, 1 and 2 invisible State 3: All visible State 4: None visible However, if I have the same grids and the user can interactively set which are visible and not visible I find it easier to simply set the visible and includeInLayout properties of the grids directly without the use of view states. hth Scott Scott Melby Founder, Fast Lane Software LLC http://www.fastlanesw.com http://www.fastlanesw.com http://blog.fastlanesw.com http://blog.fastlanesw.com sk_acura wrote: Hi All, I am trying to display multiple DataGrids in a Panel. User will have the option of switching between DataGrids. What's the advantages of having one DataGrid with multiple states (if that is possible).. I am planning to do it by defining one DataGrid ( as the Structure of these data grids are different) for each of my views and showing and hiding them depending on user selection. Could some one point out the pros cons of each approach.. Thanks Mars
Re: [flexcoders] View States Vs using the visible flag with multiple UI components..
I think if you wanted to reuse a single DataGrid and states, you would have to keep multiple Arrays representing the columns each DataGrid needed, and in your states set the columns property of the DataGrid to the appropriate Array of columns, and then set the dataProvider to the appropriate dataProvider for that grid. Could be done but might not be worth it? Keep in mind if you're toggling the visibility property and you're in a container that isn't absolutely laid out, the grids will still take up the same amount of space, it'll just be a big empty square. You'll also need to toggle the includeInLayout property. I believe this could be a pretty ineffecient mechanism thought because each invalidate/update pass on your parent container would be slowed down since these objects are still on the display list but are just ignored in the layout/measurement passes? I'm more of an ActionScript junkie than an MXML guy, so assuming all the grid properties except for columns and dataProvider were the same, I'd build the grid and columns in ActionScript and then swap them out in AS based on the comboBox or whatever the user is selecting to change the view. Just my 2 cents though. On Tue, Apr 15, 2008 at 7:58 AM, sk_acura [EMAIL PROTECTED] wrote: Hi All, I am trying to display multiple DataGrids in a Panel. User will have the option of switching between DataGrids. What's the advantages of having one DataGrid with multiple states (if that is possible).. I am planning to do it by defining one DataGrid ( as the Structure of these data grids are different) for each of my views and showing and hiding them depending on user selection. Could some one point out the pros cons of each approach.. Thanks Mars