我正在尝试将指定的值设置为YUI菜单按钮,以便使用之前操作中的值。
记住之前的选择。
对于标签我已经知道我可以用以下方法更改它:
button.set("label", "my label")
不幸的是,我无法使用 button.set("value", "my value")
关于如何做到这一点的任何想法?
其他方式是强制选择,但我不知道如何做到这一点。
由于
答案 0 :(得分:0)
刚刚发现你可以使用:
var menu = button.getMenu();
var item = menu.getItem(index);
button.set("selectedMenuItem", item);
现在剩下的就是找到所需的索引