1
0
Fork 0
forked from 0x2620/oxjs

don't throw errors in menu when accessing non-existing items

This commit is contained in:
rlx 2011-11-07 18:17:16 +00:00
commit 314788dd24
2 changed files with 14 additions and 7 deletions

View file

@ -140,7 +140,8 @@ Ox.MainMenu = function(options, self) {
checkItem <f> checkItem
@*/
that.checkItem = function(id) {
that.getItem(id).options({checked: true});
var item = that.getItem(id);
item && item.options({checked: true});
return that;
};
@ -148,7 +149,8 @@ Ox.MainMenu = function(options, self) {
disableItem <f> disableItem
@*/
that.disableItem = function(id) {
that.getItem(id).options({disabled: true});
var item = that.getItem(id);
item && item.options({disabled: true});
return that;
};
@ -156,7 +158,8 @@ Ox.MainMenu = function(options, self) {
enableItem <f> enableItem
@*/
that.enableItem = function(id) {
that.getItem(id).options({disabled: false});
var item = that.getItem(id);
item && item.options({disabled: false});
return that;
};
@ -229,7 +232,8 @@ Ox.MainMenu = function(options, self) {
};
that.setItemTitle = function(id, title) {
that.getItem(id).options({title: title});
var item = that.getItem(id);
item && item.options({title: title});
return that;
};
@ -237,7 +241,8 @@ Ox.MainMenu = function(options, self) {
uncheckItem <f> uncheckItem
@*/
that.uncheckItem = function(id) {
that.getItem(id).options({checked: false});
var item = that.getItem(id);
item && item.options({checked: false});
return that;
};