This is a migrated thread and some comments may be shown as answers.

Inconsistencies between simulator and device

2 Answers 31 Views
Report a bug
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jan-Dirk
Top achievements
Rank 1
Jan-Dirk asked on 24 Sep 2012, 09:46 AM
I am working on an app that has an index page with a menu (currently 1 menu item 'categories' and, currently, 2 html pages below that index page, namely: prodcategories.html (called from menu item catategories) and prodsubcategories.html (called from categories shown in prodcategories.html).

I use a database to store categories and subcategories (both in the same table). Page prodcategories.html checks if the tables is filled and not outdated. When needed it does an xmlhttprequest to a web service that return (sub)categories in xml and the database is filled or refilled.

I had this working in the simulator, but when I moved the app to my device only index.html was shown. Clicking the 'categories' menu item (which is a listview item) showed a new page with a busy-indicator. Nothing happened after that.

At the time I created the project I selected to use JQuery mobile (jq: 1.7.2.min and jqm 1.1.0.min). I am not sure if my problems were caused by JQM, but it might be worth to mention. I think that Cordova 2.0 is used.

Normally you would expect that after onDeviceReady is fired the app is ready to load data from database. In the simulators did never seemed to work, but I was able to solve it by using this script at the bottom of my html (before the closing body-tag):

        <script src="jquery-mobile/jquery-1.7.2.min.js" type="text/javascript"></script>
        <script src="jquery-mobile/jquery.mobile-1.1.0.min.js" type="text/javascript"></script>
        <script src="js/prodsubcategories.js" type="text/javascript"></script>
        <script src="js/hobbyking.js" type="text/javascript"></script>

        <script>
            $('#prodsubcategories').bind('pageinit', function(event, ui) {
                initSubCategories();
            });
        </script>

when I moved to the device, it turned out that this didn't work. To get it to work I moved all script references to the header (before the reference to cordova.js) and moved the initSubCategories() to the header to with this code:

        <script>
            document.addEventListener("deviceready", onDeviceReady, false);
            
            function onDeviceReady() {
                initCategories();
            }
        </script>

Now it worked on my device, but not in the simulators.

Can someone from Icenium see if there are any inconsistencies between devices and simulators? if it works on the simulator, it should work on the device and vice versa.

When needed, I can provide my code.

2 Answers, 1 is accepted

Sort by
0
iliev
Telerik team
answered on 27 Sep 2012, 09:41 AM
Hello,

We know of some issues with the simulator that can be causing this in the current beta version. Basically if onDeviceReady stops working it should get fired when you restart Icenium Graphite.
In our current development environment we have resolved many of these issues. Stay tuned for upcoming future updates :)
0
Jan-Dirk
Top achievements
Rank 1
answered on 27 Sep 2012, 02:01 PM
Thank you for replying. Looking forward to it!
Tags
Report a bug
Asked by
Jan-Dirk
Top achievements
Rank 1
Answers by
iliev
Telerik team
Jan-Dirk
Top achievements
Rank 1
Share this question
or