MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

Sample widget for requestNavigateTo

Last post 03-15-2008 3:00 AM by jiangtao. 31 replies.
Page 2 of 3 (32 items) < Previous 1 2 3 Next >
Sort Posts: Previous Next
  • 03-06-2008 9:33 AM In reply to

    • James
    • Top 150 Contributor
    • Joined on 02-15-2008
    • Posts 27

    Re: Sample widget for requestNavigateTo

     Ahhhhhhhhhhhhhhh - I get ya!!

     Thanks for the help! :)

  • 03-10-2008 1:40 AM In reply to

    • Tim
    • Not Ranked
    • Joined on 01-30-2008
    • Posts 5

    Re: Sample widget for requestNavigateTo

    Hi Chad, 

    opensocial.getEnvironment().getParams() is returning a blank object despite passing in a valid appParams on the canvas page.

    opensocial.Container.get().registerParam("appParams", gadgets.JSON.parse(decodeURIComponent('{"page":"about"}')));

    is run, but getParams() still returns an empty object.

     

    Also,  the code in your initial post (example of requestNavigateTo) was working earlier today, but now results in "Your source contains errors. Please correct and try again." No error messages show up when hitting "show messages" though.

    Hope this stuff is working soon! Thanks

     

  • 03-10-2008 11:30 AM In reply to

    • Tony
    • Not Ranked
    • Joined on 02-05-2008
    • Posts 3

    Re: Sample widget for requestNavigateTo

     This worked for me last week and then today it seems that the params are not being passed in.  Last week, the requestNavigateTo function would put a URI encoded JSON object into the URL of the resulting page.  That JSON object would get passed through and was available with getParams().  Today, the URL isn't changing when I call requestNavigateTo with params...

    MySpace... please help.  Hopefully this will be fixed before the soft launch.  :( 

  • 03-10-2008 12:46 PM In reply to

    Re: Sample widget for requestNavigateTo

     Yes, this was working last night -- changing views and passing custom parms. As of right now, I can't switch to any view.

  • 03-11-2008 7:08 AM In reply to

    • James
    • Top 150 Contributor
    • Joined on 02-15-2008
    • Posts 27

    Re: Sample widget for requestNavigateTo

    Tony:

     This worked for me last week and then today it seems that the params are not being passed in.  Last week, the requestNavigateTo function would put a URI encoded JSON object into the URL of the resulting page.  That JSON object would get passed through and was available with getParams().  Today, the URL isn't changing when I call requestNavigateTo with params...

    MySpace... please help.  Hopefully this will be fixed before the soft launch.  :( 

     

    Yeah - exactly this.

    Can we get an update on thisor is there a new method? Having navigation working would be pretty handy at this stage!

    Thanks...

  • 03-11-2008 10:58 AM In reply to

    Re: Sample widget for requestNavigateTo

    Sorry, working on a fix, bear with us.
  • 03-12-2008 9:30 AM In reply to

    Re: Sample widget for requestNavigateTo

     Any update? Thanks...

  • 03-12-2008 10:01 AM In reply to

    Re: Sample widget for requestNavigateTo

     I'll include my post from  http://developer.myspace.com/Community/forums/t/870.aspx here too:

    requestNavigateTo works, but gadgets.views.getParams() returns an empty object ({}). I stepped through the gadgets code and on line 1325 it attempts to grab the params via the 'view-params' key (if (urlParams["view-params"]) {), but according to the debugger the params are storred under the key 'p' (looking at the resulting iframe url confirms this).

  • 03-12-2008 10:17 AM In reply to

    Re: Sample widget for requestNavigateTo

    Can someone please help me out. this is not working for me:

    function navigate(){
                var params = {};
                var isPrimary = true;
                var surfaceName = 'canvas';
    var surfaces = opensocial.getEnvironment().getSupportedSurfaces();
                var nav_surface;
    for(var i = 0; i < surfaces.length; i++){
         if(surfaces[i].getName() === MyOpenSpace.Surface.Field.CANVAS) { nav_surface = surfaces[i]; break; }
    }
    opensocial.requestNavigateTo(nav_surface, {});
    }

     I try to navigate from my profile to the canvas pag. With this code I get no errors just nothing happens..

  • 03-12-2008 10:22 AM In reply to

    • Eric
    • Top 500 Contributor
    • Joined on 02-06-2008
    • Posts 17

    Re: Sample widget for requestNavigateTo

     Kristaps:

     Using the following works for me:


    var surfaces = gadgets.views.getSupportedViews();
    var surfaceRef = surfaces[surfaceName];
    gadgets.views.requestNavigateTo(surfaceRef, {});

  • 03-12-2008 11:32 AM In reply to

    Re: Sample widget for requestNavigateTo

    Eric - Thank you very much! It worked 

  • 03-12-2008 11:40 AM In reply to

    Re: Sample widget for requestNavigateTo

    Double-thanks -- I had just run into this problem.

  • 03-12-2008 12:01 PM In reply to

    Re: Sample widget for requestNavigateTo

    Eric:

     Using the following works for me:


    var surfaces = gadgets.views.getSupportedViews();
    var surfaceRef = surfaces[surfaceName];
    gadgets.views.requestNavigateTo(surfaceRef, {});


    Thanks Eric, still can't pass params though?

  • 03-12-2008 3:33 PM In reply to

    Re: Sample widget for requestNavigateTo

    updated sample 

     

    <select id="ddl_canvas">

                    <option value="home">home</option>

                    <option value="profile">profile.left</option>

                    <option value="profile.right">profile.right</option>

                    <option value="canvas">canvas</option>

    </select>

    <br>

    Value One: <input type="text" id="txtParamOne" />

    <br>

    Value Two: <input type="text" id="txtParamTwo" />

    <br>

    <input type="button" onclick="navigate()" value="Submit" />

     

    <script type="text/javascript" id="MSOS_HOME">

                    function navigate(){

                                    var params = {};               

                                    var isPrimary = false;

                                   

                                    var surfaceName = document.getElementById('ddl_canvas').value;

                                    if (surfaceName === 'canvas')

                                                    isPrimary = true;

                                   

                                    var surfaces = gadgets.views.getSupportedViews();

                                    var surfaceRef = surfaces[surfaceName];

                                   

                                    params['param1'] = document.getElementById('txtParamOne').value;

                                    params['param2'] = document.getElementById('txtParamTwo').value;

                                    gadgets.views.requestNavigateTo(surfaceRef, params);

                                    }

                   

                    function init() {

                                    var params1 = opensocial.getEnvironment().getParams();

                                    if ('undefined'===typeof(params1) || 'undefined' === typeof(params1['param1'])){

                                                    return; 

                                    }

                                    document.getElementById('txtParamOne').value = params1['param1'];

                                    document.getElementById('txtParamTwo').value = params1['param2'];

                    }

                    init();

    </script>

    Follow us on twitter for major updates and announcements:

    http://twitter.com/MySpaceDevTeam

    Friend the MDP Profile!
    http://www.myspace.com/myspacedeveloperplatform
  • 03-12-2008 4:23 PM In reply to

    Re: Sample widget for requestNavigateTo

    Thanks! I was hoping someone would do that. Not me, because that looks like work, but, you know, someone...

Page 2 of 3 (32 items) < Previous 1 2 3 Next >