1

I am working on a worklight App using it's default 1.9 Dojo Toolkit. My App is working fine in Android emulator and in the web browser simulator. I tried to test the same app in Windows phone 8 Emulator but I am not able to see the whole Home page. I can see only Tabbar Button part used at the button while I am not able to see the list items used in the page. My Question is does Dojo Toolkit 1.9 supports Windows Phone 8?

I have visited dojo 1.9 release link and It says that in dojo 1.9, support for Windows Phone 8 has been included. If this is true, What could be the reason of failure for my app in Windows phone 8 emulator?

I also got below log when I created Windows phone 8 environment in my Worklight Project.

     [2013-11-12 22:14:08]             Environment 'Windows Phone 8' was created.
     [2013-11-12 22:14:13]             Starting build process: application 'KaiserTestApp', environment 'windowsphone8'
     [2013-11-12 22:14:28]             Windows Phone 8 app may not work well with Dojo toolkit included for this Application.  Use a different Worklight Project, without Dojo toolkit, for Windows Phone 8 apps.
     [2013-11-12 22:14:28]             Application 'KaiserTestApp' with environment 'windowsphone8' build finished.

home page

Anil kumar
  • 525
  • 2
  • 10
  • 32
  • What is your Worklight version? – Idan Adar Dec 02 '13 at 07:36
  • It's worklight latest version 6. – Anil kumar Dec 02 '13 at 08:31
  • Any errors in the Output view in Visual Studio related to Dojo? – Idan Adar Dec 02 '13 at 08:36
  • 1
    Worklight 6 with Dojo 1.9 supports Windows Phone 8; the Windows Phone 8 theme is experimental. – Idan Adar Dec 02 '13 at 08:36
  • No error in the output view but I have forced the device theme as Iphone as I wanted the look and feel like Iphone. I think this could be a reason. I will remove this condition and let you know. – Anil kumar Dec 02 '13 at 08:54
  • Hi Idan, It seems the problem is not with the device theme but with the dojo listitems only. I am yet to work on the monkey patching. I am going though the articles explaining Monkey patching. I will update here once I do this. – Anil kumar Dec 04 '13 at 07:26
  • @Idan: is there any good article explaining the steps for Monkey Patching in Worklight v6 when we use default dojo library? – Anil kumar Dec 04 '13 at 07:31
  • Not that I am aware of, as monkey patching is not at all exclusive to Worklight. It's a programming technique: 1) http://stackoverflow.com/questions/5741877/is-monkey-patching-really-that-bad 2) http://en.wikipedia.org/wiki/Monkey_patch – Idan Adar Dec 04 '13 at 07:37

1 Answers1

1

There is a WP8 VM bug that might hurt ListItem and might explain your issue. To check if that you are falling into this just monkey patch the _ItemBase _setSelectedAttr method this way and see if that fixes your issue:

    _setSelectedAttr: function(/*Boolean*/selected){
        // summary:
        //      Makes this widget in the selected or unselected state.
        // description:
        //      Subclass should override.
        // tags:
        //      private
        if(selected){
            var p = this.getParent();
            if(p && p.selectOne){
                // deselect the currently selected item
                var arr = array.filter(p.getChildren(), function(w){
                    return w.selected;
                });
                array.forEach(arr, function(c){
                    this._prevSel = c;
                    c.set("selected", false);
                }, this);
            }
        }
        this.selected = selected;
        //this._set("selected", selected);
    }

If that is fixing your issue let us know and we will see how to release an updated version of Dojo that workarounds that WP8 WM bug.

Christophe
  • 736
  • 5
  • 15
  • Thanks for the reply Chris... It seems the problem is with listitems only..I will test the monkey patching and let you know. – Anil kumar Dec 04 '13 at 07:29
  • @Chris-I am referring first answer of this link "http://stackoverflow.com/questions/17543998/ibm-worklight-6-0-how-to-include-dojo-patch-with-pre-built-dojo-layers". Can I just replace "CSS3" with _"ItemBase _setSelectedAttr" and the prototype function with the method you included in the answer for the monkey patch to work? – Anil kumar Dec 04 '13 at 09:29
  • Hi Christophe, I was not able to figure out how to use Monkey patch in my case so I replaced the _setSelectedAttr method in my original _itemBase.js file which was kept in dojo/mobile folder. But even after trying this the html page linked to the tab bar button is not displaying. Any other suggestions?? – Anil kumar Dec 05 '13 at 09:50
  • Ok. So either you are not facing the problem I was suspecting or maybe your device is using a built version of dojo and not querying the patched file? (you could check that by putting some kind of console.log in the patched file to see if it is actually loaded). – Christophe Dec 05 '13 at 10:17
  • I added console.log statement in the setSelectedAttr function but it is not displaying in the console. so, this means it is using built version of dojo. what should I do then?? There is one www folder in my project which has devicetheme.js,core_web_layer.js,mobile_ui_layer.js and dojo.js files but I haven't found this function in any of the files. – Anil kumar Dec 05 '13 at 10:31
  • @Christophe- I found this function in mobile-ui-layer.js file. I made the change as per your suggestion. I also added one console.log statement. Console.log is printing the string as expected now but the html page linked to the Tabbar buttons are still not showing up. Is there anything else where I need to make the change? Problem is only with tabbar buttons. Please help. – Anil kumar Dec 06 '13 at 05:54
  • So you are definitely facing a different issue... what about posting somewhere a minimal sample that reproduces the problem so someone can help you investigate? – Christophe Dec 06 '13 at 08:06
  • I have raised a ticket to IBM for this and L3 is looking into this. I have also given a sample test app which reproduces the issue. Let's see if I get any help from them. – Anil kumar Dec 06 '13 at 08:22