[ 3 posts ]

A B Roy

  • Username: ankur_b
  • Joined: Sun Feb 27, 2011 9:17 pm
  • Posts: 6
  • Offline
  • Profile
Tags:

YAHOO.widget.Menu do not scroll to selected item

Post Posted: Sun Feb 27, 2011 9:53 pm
+0-
YAHOO.widget.Menu do not scroll to selected item

I need to scroll down to the selected item of my popup menu I am highlighting in the scroll menu I developed, everything else works fine but following code does not work.

oMenu.show();
//oMenu.getItem(idx).cfg.focus();
oMenu.getItem(idx).cfg.setProperty("selected", true);

Please suggest on this as soon as possible.

Todd Smith

YUI Contributor

  • Username: stlsmiths
  • Joined: Thu Nov 05, 2009 10:03 am
  • Posts: 675
  • GitHub: stlsmiths
  • Gists: stlsmiths
  • IRC: t_smith
  • Offline
  • Profile

Re: YAHOO.widget.Menu do not scroll to selected item

Post Posted: Thu Mar 03, 2011 2:40 pm
+0-
Hi ankur_b,

Seems like you posted this several times on different parts of the forum. It looks like you are trying to use YUI 2 so if you had posted this in "YUI 2 - Components" you would have probably gotten a better response - for the future.

I took the YUI 2 example http://developer.yahoo.com/yui/examples/menu/example11.html and modified it as below;
Code:
// Create the menu ... "basicmenu" is an ID for HTML markup container
var oMenu = new YAHOO.widget.Menu("basicmenu", { fixedcenter: true } );
         
//  Populate it ...
oMenu.addItems([
    { text: "Selected MenuItem", selected: true },
    { text: "Disabled MenuItem", disabled: true },
    { text: "MenuItem With A URL", url: "http://www.yahoo.com" },
    { text: "Checked MenuItem", checked: false }
]);

// Render and show it ....         
oMenu.render();
oMenu.show();

// Setup a timer, after 3 seconds,
//     unselect first item and select/check fourth item ...
YAHOO.lang.later( 3000, this, function(){
    oMenu.getItem(0).cfg.setProperty('selected',false);
    oMenu.getItem(3).cfg.setProperty('selected',true);
    oMenu.getItem(3).cfg.setProperty('checked',true);
});

This works for me.

Good luck,
Todd

A B Roy

  • Username: ankur_b
  • Joined: Sun Feb 27, 2011 9:17 pm
  • Posts: 6
  • Offline
  • Profile

Re: YAHOO.widget.Menu do not scroll to selected item

Post Posted: Wed Mar 09, 2011 9:42 pm
+0-
As suggested , updated issue in YUI2.x forum.
description is there and this solution is not working for my case.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum