I have a menu command used to toggle a grid row between “active” and “inactive” states. I.e., when an item in the grid is “active” the menu command is to show the text “Inactivate” with an image corresponding to this action. Alternatively, when an item in the grid is “inactive” the menu command is to be “Activate” withan image corresponding to that action. Everything seems to be working fine except that the text, while evidently changed programatically, is not showing up in the actual menu display. Oddly, the image is changing as intended.
Here’s what the code looks like, invoked upon right-click (with a couple of diagnostic alerts):
[code]function onGridRowClick(rowId, col, oEvent)
{
gridRowId = rowId;
gridRow = dataGrid.getRowIndex(rowId);
gridCol = col;
if (null != contextMenu.getItemType(‘menuInactivate’)
{
contextMenu.showItem(‘menuInactivate’);
switch (‘undefined’ == typeof(dataGrid.getRowAttribute(rowId,‘isInactive’)) ? -1 : 1*dataGrid.getRowAttribute(rowId,‘isInactive’))
{
case 0: // item is active
contextMenu.setItemText(‘menuInactivate’, ‘Inactivate’);
alert('R-click, row is active, itemtext= '+contextMenu.getItemText(‘menuInactivate’));
contextMenu.setItemImage(‘menuInactivate’, ‘Inactivate.png’, ‘Inactivate_disabled.png’);
break;
case 1: // item is inactive
contextMenu.setItemText(‘menuInactivate’, ‘Activate’);
alert(‘R-click, row is inactive, itemtext=’+contextMenu.getItemText(‘menuInactivate’));
contextMenu.setItemImage(‘menuInactivate’, ‘Activate.png’, ‘Activate_disabled.png’);
break;
default:
contextMenu.hideItem(‘menuInactivate’);
break;
}
}
return true;
}[/code]
Here’re some screen shots of the menu and the diagnostic alerts:
On the first right-click on the bottom row, which starts “active.” You can see that the diagnostic alert shows this, and that the text is, at that time, set to “Inactivate.” When the context menu appears, is is as it should be, showing the correct text and =image:
The row’s color is changed to show it’s “inactive” and then another right-click is done. Here’s the diagnostic alert, showing the proper status, and that the text has been set to “Activate.” Yet when the context menu appears, the text is still “Inactivate.” Obviously the code was executed, since not only did the alert appear, but the image was properly changed as well.
I’m puzzled.