I'm trying to toggle the check on a MenuItem when clicked using the following code (snippet):
MenuItemIfFunction headerIfFunc = new MenuItemIfFunction() {
public boolean execute(Canvas target, Menu menu, MenuItem item)
{
return (itemIsVisible[j]);
}
};
com.smartgwt.client.widgets.menu.events.ClickHandler menuItemClickHandler = new com.smartgwt.client.widgets.menu.events.ClickHandler()
{
public void onClick(MenuItemClickEvent event)
{
itemIsVisible[j] = !itemIsVisible[j];
}
};
newMenuItem.setCheckIfCondition(headerIfFunc);
newMenuItem.addClickHandler(menuItemClickHandler);
.
.
.
itemIsVisible is a class-level boolean array, and the setup is that these menu items are bound to a Menu that itself is a submenu.
The JavaScript error occurs when the "parent" menu item is clicked. It pops up repeatedly, apparently for each menu item in the submenu:
com.google.gwt.core.client.JavaScriptException: (TypeError): elem is null
fileName: http://127.0.0.1:8888
lineNumber: 122
stack: (null,"__ref")@http://127.0.0.1:8888:122
@:0
(null,10813539,(void 0))@http://127.0.0.1:8888/ipgui/hosted.html?ipgui:56
((void 0),[object Object],[object Object])@http://127.0.0.1:8888:5
((function (target, menu, item) {var targetJ;if (__gwt_makeJavaInvoke(1)(null, 10813539, target)) {targetJ = __gwt_makeJavaInvoke(1)(null, 10813537, target);} else {targetJ = __gwt_makeJavaInvoke(1)(null, 131188, target);}var menuJ = __gwt_makeJavaInvoke(1)(null, 131188, menu);var itemJ = __gwt_makeJavaInvoke(1)(null, 7209026, item);return __gwt_makeJavaInvoke(3)(checkIf, 10878977, targetJ, menuJ, itemJ);}),[object Object],[object Object])@http://127.0.0.1:8888:6
@:0
(null,65563,(function (target, menu, item) {var targetJ;if (__gwt_makeJavaInvoke(1)(null, 10813539, target)) {targetJ = __gwt_makeJavaInvoke(1)(null, 10813537, target);} else {targetJ = __gwt_makeJavaInvoke(1)(null, 131188, target);}var menuJ = __gwt_makeJavaInvoke(1)(null, 131188, menu);var itemJ = __gwt_makeJavaInvoke(1)(null, 7209026, item);return __gwt_makeJavaInvoke(3)(checkIf, 10878977, targetJ, menuJ, itemJ);}),[object Object],[object Object])@http://127.0.0.1:8888/ipgui/hosted.html?ipgui:56
((void 0),[object Object],[object Object])@http://127.0.0.1:8888:24
((void 0),[object Object],[object Object])@http://127.0.0.1:8888:13
anonymous()@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Grids.js?isc_version=7.0.js:2924
isc_Menu_show()@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Grids.js?isc_version=7.0.js:2862
isc_Menu_placeSubmenu([object Object],[object Object])@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Grids.js?isc_version=7.0.js:2911
isc_Menu_showSubmenu([object Object])@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Grids.js?isc_version=7.0.js:2902
isc_Menu_changeSubmenu()@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Grids.js?isc_version=7.0.js:2899
isc_c_Class_fireCallback([object Object],(void 0),[object Array],[object Object],true)@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:301
isc_c_Timer__fireTimeout("$ir641")@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:1187
@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:1182
: null[Ljava.lang.StackTraceElement;@2a3d8cdc
MenuItemIfFunction headerIfFunc = new MenuItemIfFunction() {
public boolean execute(Canvas target, Menu menu, MenuItem item)
{
return (itemIsVisible[j]);
}
};
com.smartgwt.client.widgets.menu.events.ClickHandler menuItemClickHandler = new com.smartgwt.client.widgets.menu.events.ClickHandler()
{
public void onClick(MenuItemClickEvent event)
{
itemIsVisible[j] = !itemIsVisible[j];
}
};
newMenuItem.setCheckIfCondition(headerIfFunc);
newMenuItem.addClickHandler(menuItemClickHandler);
.
.
.
itemIsVisible is a class-level boolean array, and the setup is that these menu items are bound to a Menu that itself is a submenu.
The JavaScript error occurs when the "parent" menu item is clicked. It pops up repeatedly, apparently for each menu item in the submenu:
com.google.gwt.core.client.JavaScriptException: (TypeError): elem is null
fileName: http://127.0.0.1:8888
lineNumber: 122
stack: (null,"__ref")@http://127.0.0.1:8888:122
@:0
(null,10813539,(void 0))@http://127.0.0.1:8888/ipgui/hosted.html?ipgui:56
((void 0),[object Object],[object Object])@http://127.0.0.1:8888:5
((function (target, menu, item) {var targetJ;if (__gwt_makeJavaInvoke(1)(null, 10813539, target)) {targetJ = __gwt_makeJavaInvoke(1)(null, 10813537, target);} else {targetJ = __gwt_makeJavaInvoke(1)(null, 131188, target);}var menuJ = __gwt_makeJavaInvoke(1)(null, 131188, menu);var itemJ = __gwt_makeJavaInvoke(1)(null, 7209026, item);return __gwt_makeJavaInvoke(3)(checkIf, 10878977, targetJ, menuJ, itemJ);}),[object Object],[object Object])@http://127.0.0.1:8888:6
@:0
(null,65563,(function (target, menu, item) {var targetJ;if (__gwt_makeJavaInvoke(1)(null, 10813539, target)) {targetJ = __gwt_makeJavaInvoke(1)(null, 10813537, target);} else {targetJ = __gwt_makeJavaInvoke(1)(null, 131188, target);}var menuJ = __gwt_makeJavaInvoke(1)(null, 131188, menu);var itemJ = __gwt_makeJavaInvoke(1)(null, 7209026, item);return __gwt_makeJavaInvoke(3)(checkIf, 10878977, targetJ, menuJ, itemJ);}),[object Object],[object Object])@http://127.0.0.1:8888/ipgui/hosted.html?ipgui:56
((void 0),[object Object],[object Object])@http://127.0.0.1:8888:24
((void 0),[object Object],[object Object])@http://127.0.0.1:8888:13
anonymous()@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Grids.js?isc_version=7.0.js:2924
isc_Menu_show()@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Grids.js?isc_version=7.0.js:2862
isc_Menu_placeSubmenu([object Object],[object Object])@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Grids.js?isc_version=7.0.js:2911
isc_Menu_showSubmenu([object Object])@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Grids.js?isc_version=7.0.js:2902
isc_Menu_changeSubmenu()@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Grids.js?isc_version=7.0.js:2899
isc_c_Class_fireCallback([object Object],(void 0),[object Array],[object Object],true)@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:301
isc_c_Timer__fireTimeout("$ir641")@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:1187
@http://127.0.0.1:8888/ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:1182
: null[Ljava.lang.StackTraceElement;@2a3d8cdc
Comment