5 Replies Latest reply on May 11, 2009 11:13 AM by Gregory Lafrance

    datagrid/ viewstack questions

    dzdrazil

      I'm working on an application for a friend who needs an application that essentially shows off a consulting model he showed me in an excel spreadsheet.  It's set up with about 10 to 12 small tables under different 'categories', with each row having a checkbox (true if the row is included in the data model, false if the customer doesn't want to consider it) and a value at the end of each row that is computed from other values in the row.

       

      My initial thought was to have a viewstack and each layer be a datagrid for each 'table', except I only programmed one of the grids and put blank grids in the rest, and the program already takes a significant amount of time to load ("significant" because my friend wants load time to be at best unnoticeable).

       

      Should I instead have a custom panel that dynamically re-draws the grid based on which nav button is clicked, instead of having all 12 tables made at run-time?  Also, just to be sure, should I be making different custom datagrids for each of the 12 tables, or should I be looking at doing something like a datagrid 'factory pattern'?

       

      Other pages of the application will be dependent on the calculated values for each table, so I'll also need to find a way for the calculated values to be stored and updated every time they change, but I'm reasonably certain at this point that I know which direction to go in to do this.  Thanks!

        • 1. Re: datagrid/ viewstack questions
          Gregory Lafrance Level 6

          Just have one DataGrid, and change the data it displays based on the nav buttons.

           

          You could have separate dataProvider ArrayCollection or XMLListCollection objects for each set of data.

           

          If this post answers your question or helps, please mark it as such.

          1 person found this helpful
          • 2. Re: datagrid/ viewstack questions
            dzdrazil Level 1

            One quick clarification quesiton, which event should be responsible for re-calculating the variable numbers in the arraycollection?  the itemClick property of the mxml for the datagrid?  or would best practice be to handle that functionality elsewhere in the module/application?  I'm a bit new to MVC/ loose coupling techniques, so where to put what functionality is often a bit difficult for me to visualize.

            • 3. Re: datagrid/ viewstack questions
              Gregory Lafrance Level 6

              Can you clarify on what the calculations are for?

               

              You could store calculations for the currently displayed data in another ArrayCollection.

               

              You could update the calculations from the "show" event, or perhaps the "dataChange" event of the DataGrid.

              • 4. Re: datagrid/ viewstack questions
                dzdrazil Level 1

                each table can basically be seen as four columns- the first is a checkbox to include or ignore that section of the model.  the second and third columns represent numeric input, either integers or decimals, always positive.  The final column is a non-editable basic calcualtion of the second and third columns, assuming they aren't zero or inactive (i.e. a*b*12 or something simple like that).

                 

                The issue is that not all of the tables have the same number of inputs, and the formula for that final calculated value is different for each table- might be multiplied by a different number, or the relation between the inputs are different, etc.  Also, there is a seperate state with a table that is like a cash flow analysis, which is dependant on all of the calculated values, and possibly a third state which contains graphs and other data-visualization components.

                 

                My initial layout was a 3 state application, with the first state having a viewstack and 12 layers, each with their own datagrid, the second being the cashflow table and the third being the graphs and such.  However, it appears that's way too many unnecessary components in the viewstack, so I'm looking at replacing that viewstack with a datagrid that redraws itself based on the sub-navigation buttons.  Does this sound about right?

                • 5. Re: datagrid/ viewstack questions
                  Gregory Lafrance Level 6

                  I think having one DataGrid whose data changes depending on the nav buttons is fine.

                   

                  I guess I'm not getting the relationship with the other areas of your app, so I can answer your other question(s).