--- In ydn-javascript@yahoogroups.com, "Pawel Sokolowski" <sokolo@...>
wrote:
>
> var projectName = this.cfg.getProperty("text");
> only gets the value of the property text not the value of the
property value
> I need to grab the value of the property value so that :
>
> { text: "one", value: 1, onclick: { fn: onMenuItemClick } },
> { text: "two", value: 2, onclick: { fn: onMenuItemClick } },
> { text: "three", value: 3, onclick: { fn: onMenuItemClick } }
>
> when "one" is clicked i can read value which is == 1.
>
> is there a way to access this property ?
>
> Thanks,
>
> Pawel
> On Wed, Jan 7, 2009 at 2:54 PM, a Eric Daniel Leon Gonzalez
<gonzalez@...
> > wrote:
>
> > function onMenuItemClick(p_sType, p_aArgs, p_oValue) {
> > // Set project title
> > var projectName = this.cfg.getProperty("text");
> > }
> >
> > Does that help?
> >
> > ------------------------------
> > *From:* ydn-javascript@yahoogroups.com [mailto:
> > ydn-javascript@yahoogroups.com] *On Behalf Of *Pawel Sokolowski
> > *Sent:* Wednesday, January 07, 2009 11:29 AM
> > *To:* ydn-javascript@yahoogroups.com
> > *Subject:* [ydn-javascript] MenuButton - how to get value of the
selected
> > item
> >
> > Hello,
> >
> > Is there way to retrieve a value of the selected item in the event
handler
> > "onMenuItemClick" ? Please see the code below that was taken from the
> > examples at YUI page.
> >
> > // "click" event handler for each item in the Button's menu
> > function onMenuItemClick(p_sType, p_aArgs, p_oItem) {
> >
> > oMenuButton4.set("label", p_oItem.cfg.getProperty("text"));
> > // there is no property value in the config object
> >
> > alert(p_oItem.cfg.getProperty("value"));
> > }
> >
> > // Create an array of YAHOO.widget.MenuItem configuration properties
> >
> > var aMenuButton4Menu = [
> >
> > { text: "one", value: 1, onclick: { fn: onMenuItemClick } },
> > { text: "two", value: 2, onclick: { fn: onMenuItemClick } },
> > { text: "three", value: 3, onclick: { fn: onMenuItemClick } }
> >
> > ];
> >
> > /*
> > Instantiate a Menu Button using the array of YAHOO.widget.MenuItem
> > configuration properties as the value for the "menu" configuration
> > attribute.
> > */
> >
> > var oMenuButton4 = new YAHOO.widget.Button({
> > type: "menu",
> > label: "one",
> > name: "mymenubutton",
> > menu: aMenuButton4Menu,
> > container: "menubuttonsfromjavascript" });
> >
> >
> >
>
My advice (until someone here posts a definitive answer): use Firefox
and install Firebug:
https://addons.mozilla.org/en-US/firefox/addon/1843
Firebug is a developer's dream come true!