Sencha Loading in the iPhone 4

code | 10-19-2010

So, I recently was working on a project using Sencha Touch and Phonegap to create an iPhone App and everything worked perfectly when I was using the emulator for the iPhone 3, but when I emulated it for the iPhone 4, it wouldn't load anything at all. The solution? Apparently, the DOM was still rendering when the Ext.onReady block was firing because the iPhone 4 was not properly using the Ext.onReady block.

I'm still not sure if that was the fault of Sencha Touch or Phonegap, but here is the solution:

   <head>
      <script>
         BodyOnLoad = function(){
            Ext.onReady(function(){
               // Your code to execute
            });
         }
      </script>
   </head>
   <body onload=”BodyOnLoad()”></body>
</html>

As you can see, the secret is to use a body onload function to encapsulate the Ext.onReady function so that it doesn't fire until the body is loaded.



About the Author

Tyson Cadenhead is a Senior JavaScript Developer at Aloompa. He lives in the greater Nashville area. His specialty is writing large, scalable JavaScript applications on the client and server side. His passions are for good design, usability, and clean, reusable code.

Tags: Sencha Touch

Related Posts:

comments powered by Disqus

Don't Miss Anything!

Sign Up For My Email Newsletter

I Wrote a Book!

Popular Posts