3 Replies Latest reply on Jul 7, 2010 1:45 AM by Hitesh_Patel

    How to show loading screen when the large data is fetched from database

    Hitesh_Patel

      Hi Guyz,

       

      I have an AIR application wherein I have a search screen. When the user hits the search button, a database call is being triggered and the SQL result is being displayed in the Datagrid.

       

      However, the data retrieval process takes time and the screen just hangs out. I am looking for a solution by which I can display the loading image, and not make the screen hang out, so that the user can at least make out that something is happening in the background.

       

      I tried to use the TitleWindow and placed the loading image over there. But that popup never appears on the screen.

       

      Looking ahead for the discussion/solution.

       

      Thanks,

      Hitesh Patel.

        • 1. Re: How to show loading screen when the large data is fetched from database
          Hitesh_Patel Level 1

          I added some debugging info to see which part of the process is time consuming. I found that the query execution is just taking 20 sec. However converting the data (~12000 records) to Array and then setting that as a dataProvider to the DataGrid is taking ~2 mins.

           

          Is there a better way to create a dataProvider for DataGrid other then converting it to Array??

           

           

          Thanks,

          Hitesh Patel.

          • 2. Re: How to show loading screen when the large data is fetched from database
            DMcQ

            Hitesh,

             

            Just a thought: you may want to delay the call to the database to give your popup a chance to display before the system locks down while the SQL call and array population logic happens.


            You could do this with callLater() or even using a timer. Just give the player a chance to show your popup before the other code starts.

             

            I do this in my app when parsing a large bit of data. Unfortunately, since we don't have threads we can't show some kind of animated dialog or a progress bar. But you could fake this as well by doing your parsing in chunks and allowing the player to update the display, including the dialog window and some kind of animated progress bar.

             

            Also, you might investigate greenthreads (http://code.google.com/p/greenthreads/). Haven't used it but seems interesting...


            FWIW,

             

            Daniel

            McQuillen Interactive

            • 3. Re: How to show loading screen when the large data is fetched from database
              Hitesh_Patel Level 1

              Hi Daniel,

               

              Thanks for your reply.

               

              The popup logic is actually placed before I execute my SQL queries. However I will try to add a little delay for the popup to apear. Another thing that I have noticed is that the screen dont get freezed, rather the entire screen becomes white the way application just hangs out.

               

              So even if the popup gets displayed, its never gonna appear. I'll check the other link which you had provided and will get back if I find anything.

               

              Thanks,

              Hitesh Patel.