简体   繁体   中英

Worklight Windows Phone 8 Application Bar API (OptionsMenu) does not appear

Looking for some guidance on a WP8 worklight problem...

Basically I'm trying to implement the WL.optionsMenu API for Windows Phone 8 to use the native Application Bar, but I'm unable to visually confirm that its appearing in the WL Browser simulator, and I'm not seeing anything on device either. Here is IBM's documentation for the optionsMenu API.

There is no indication that special build settings are required, but I figured that may be an issue.

Here is the code I use to initialize the optionsMenu in the Windows Phone 8 environment, the item I've inserted is a placeholder for what is actually in the project.

function wlEnvInit(){
    wlCommonInit();
    // Environment initialization code goes here
    WL.OptionsMenu.init({opacity: "0.5"});
    WL.OptionsMenu.addItem('homePage', function() {}, 'Go to Home', {image:'', enabled : true}); 
    WL.OptionsMenu.setEnabled(true);
    console.log(WL.OptionsMenu.getItem('homePage'));
}

If I inspect the worklight browser simulator, I see that its inserting some HTML to reflect the content, and I can view the properties of the initialized bar in the console with JQuery. The console gives the following from my console.log() above"

    <option value="Go to Home" id="homePageId">Go to Home</option>

If I try to build to device I see nothing indicating an application bar is there. The documentation for this feature in worklight is pretty shoddy, but there are a few android examples around that offered no comparable help.

In the MBS you should see it as a dropdown.

In the app, this is working fine.

JS:

WL.OptionsMenu.init();
    WL.OptionsMenu.addItem("feedsTab", displayFeedsTab, Messages.navToFeeds, {image: 'feed.png', enabled: true});
    WL.OptionsMenu.addItem("aboutTab", displayAboutTab, Messages.navToAbout, {image: 'about.png', enabled: true});

nativeResources\\applicationBar:
2 images that follow WP8's icon guidelines.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM