locked
how to fire a custom js function from windows settings flyout?

    Question

  • i had the following code for settings flyout options in my windows 8 app, now i want to fire a function when some one clicks on calculate option

     WinJS.Application.onsettings = function (e) {
                        e.detail.applicationcommands = { "help": { title: "Privacy policy", href: "privacy.html"},"fullversion":{title:"calculate", href:"fun_calculate();"} };
                        WinJS.UI.SettingsFlyout.populateSettings(e);
                    };

    i had tried with declaring function (fun_calculate();) in href but result is nill, please resolve my issue.

    Thursday, July 24, 2014 3:18 PM

Answers

  • thanx jamles but i got confused where to declare the 

    settingsFlyout.addEventListener("beforeshow", YourEventHere); as i already had WinJS.UI.SettingsFlyout.populateSettings(e), so i made another html page & implemented a button click event there.

    • Marked as answer by kranthi88 Friday, July 25, 2014 4:50 AM
    Friday, July 25, 2014 4:50 AM

All replies

  • Hi Kranthi88,

    'href' of the applicationcommand should not be any function name, but instead a html page is required.

    onbeforeshow event should help you with your question.

    settingsFlyout.addEventListener("beforeshow", YourEventHere);
    

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, July 25, 2014 2:37 AM
    Moderator
  • thanx jamles but i got confused where to declare the 

    settingsFlyout.addEventListener("beforeshow", YourEventHere); as i already had WinJS.UI.SettingsFlyout.populateSettings(e), so i made another html page & implemented a button click event there.

    • Marked as answer by kranthi88 Friday, July 25, 2014 4:50 AM
    Friday, July 25, 2014 4:50 AM