What am I doing wrong ?
Well I made a Context menu using some code found here... It took me almost no time, but much harder was implementig JS calls from it to the AW. Object call did not work so i had to use AW.all calls.
There I came to bit strange behaviour. I can not check it on FF cause this big AJAX code makes JScore of FF crash, but in IE it just starts doing for example sort, but ignores other stuff used to make the user see somethig happends.
Look at the code:
As you can see I have some IMG used to make the user see, something is working, but it never shows. Even the menu itself doesnot hide before sort starts. I have more functions (the menu is almost same in Access), but all of them has the same behaviour. Never changes cursor, never animates the IMG, hides the menu after function is finished :(
Is it IE behaviour or somethind is wrong in my code ?
(only sorting in this expample)
Thanx for advice...
There I came to bit strange behaviour. I can not check it on FF cause this big AJAX code makes JScore of FF crash, but in IE it just starts doing for example sort, but ignores other stuff used to make the user see somethig happends.
Look at the code:
// CREATE CONTEXT MENU
//***********************************************
function initContextMenu() {
document.write('<div id="contextmenu" class="contextmenu"></div>');
}
function writeContextMenu(content) {
var contextMenu = document.getElementById("contextmenu");
contextMenu.innerHTML = content;
}
function showContextMenu(e) {
var contextMenu = document.getElementById("contextmenu");
var frameWidth, frameHeight, pageOffsetX, pageOffsetY;
if (self.clientWidth) {
frameWidth = self.innerWidth;
frameHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientWidth) {
frameWidth = document.documentElement.clientWidth;
frameHeight = document.documentElement.clientHeight;
} else if (document.body) {
frameWidth = document.body.clientWidth;
frameHeight = document.body.clientHeight;
}
if (self.pageXOffset) {
pageOffsetX = self.pageXOffset;
pageOffsetY = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollLeft) {
pageOffsetX = document.documentElement.scrollLeft;
pageOffsetY = document.documentElement.scrollTop;
} else if (document.body) {
pageOffsetX = document.body.scrollLeft;
pageOffsetY = document.body.scrollTop;
}
if ((frameWidth - e.clientX) < contextMenu.offsetWidth) {
contextMenu.style.left = (pageOffsetX + e.clientX - contextMenu.offsetWidth) + "px";
} else {
contextMenu.style.left = e.clientX + "px";
}
if ((frameHeight - e.clientY) < contextMenu.offsetHeight) {
contextMenu.style.top = (pageOffsetY + e.clientY - contextMenu.offsetHeight) + "px";
} else {
contextMenu.style.top = e.clientY + "px";
}
contextMenu.style.visibility = "visible";
}
function hideContextMenu() {
if (document.getElementById("contextmenu")) document.getElementById("contextmenu").style.visibility = "hidden";
}
// Write the menu to page
initContextMenu();
// Set the click handler for the page
if (!document.addEventListener){
document.attachEvent("onclick", hideContextMenu);
} else {
document.addEventListener("click", hideContextMenu, false);
}
//*****************************************************
obj = new AW.UI.Grid;
// ROW CONTEXT MENU
//************************************************
function raiseMenuEvent(event){
this.raiseEvent("onCellContextMenu", event, this.$0, this.$1);
}
AW.UI.Grid.prototype.getCellTemplate().setEvent("oncontextmenu", raiseMenuEvent);
AW.UI.Grid.prototype.onCellContextMenu = function(event, row,col){
this.setRowSelected(row);
var obj = this.getId();
var contextMenuContent = '';
contextMenuContent += '<a class="menuItem" href="javascript:AW.all[\''+obj+'\'].filterGrid('+row+','+col+')">Filter by content</a>';
contextMenuContent += '<a class="menuItem" href="javascript:customFunctionB()">Filter out of content</a>';
contextMenuContent += '<a class="menuItem" href="javascript:customFunctionB()">Filter for: </a>';
contextMenuContent += '<a class="menuItem" href="javascript:customFunctionB()">Disable Filter or sort</a>';
contextMenuContent += '<div class="menuItemSep"></div>';
contextMenuContent += '<a class="menuItem" href="javascript:AW.all[\''+obj+'\'].menuSort('+col+',\'ascending\');">Sort Asscending</a>';
contextMenuContent += '<a class="menuItem" href="javascript:AW.all[\''+obj+'\'].menuSort('+col+',\'descending\');">Sort Descending</a>';
contextMenuContent += '<div class="menuItemSep"></div>';
contextMenuContent += '<a class="menuItem" href="javascript:customFunctionB()">New record</a>';
contextMenuContent += '<a class="menuItem" href="javascript:customFunctionB()">New record by Copy</a>';
contextMenuContent += '<a class="menuItem" href="javascript:customFunctionB()">Delete record</a>';
writeContextMenu(contextMenuContent);
showContextMenu(event);
}
// HEADER CONTEXT MENU
//************************************************
function raiseHeaderMenuEvent(event){
this.raiseEvent("onHeaderContextMenu", event, this.$0);
}
AW.UI.Grid.prototype.getHeaderTemplate().setEvent("oncontextmenu", raiseHeaderMenuEvent);
AW.UI.Grid.prototype.onHeaderContextMenu = function(event, col){
//this.setRowSelected(row);
var obj = this.getId();
var contextMenuContent = '';
contextMenuContent += '<a class="menuItem" href="javascript:AW.all[\''+obj+'\'].menuSort('+col+',\'ascending\');">Sort Ascending</a>';
contextMenuContent += '<a class="menuItem" href="javascript:AW.all[\''+obj+'\'].menuSort('+col+',\'descending\');">Sort Descending</a>';
contextMenuContent += '<div class="menuItemSep"></div>';
contextMenuContent += '<a class="menuItem" href="javascript:customFunctionA('+col+')">Column width</a>';
contextMenuContent += '<a class="menuItem" href="javascript:customFunctionB()">Hide column</a>';
contextMenuContent += '<div class="menuItemSep"></div>';
contextMenuContent += '<a class="menuItem" href="javascript:customFunctionA('+col+')">Freeze column</a>';
contextMenuContent += '<a class="menuItem" href="javascript:customFunctionB()">free freezed column</a>';
contextMenuContent += '<div class="menuItemSep"></div>';
contextMenuContent += '<a class="menuItem" href="javascript:customFunctionB()">Select columns to show</a>';
writeContextMenu(contextMenuContent);
showContextMenu(event);
}
AW.UI.Grid.prototype.menuSort = function (col,dir)
{
top.window.document.WAIS_loading.src = "images/icons/loading.gif";
top.window.document.getElementById("contextmenu").style.visibility = "hidden";
this.sort(col,dir);
this.refresh();
top.window.document.WAIS_loading.src = "images/design/blank.gif";
}
As you can see I have some IMG used to make the user see, something is working, but it never shows. Even the menu itself doesnot hide before sort starts. I have more functions (the menu is almost same in Access), but all of them has the same behaviour. Never changes cursor, never animates the IMG, hides the menu after function is finished :(
Is it IE behaviour or somethind is wrong in my code ?
(only sorting in this expample)
Thanx for advice...
ASJ
August 10,