PDA

View Full Version : Suggestion: to fix slow rendering menu...



GnuDK
22 Apr 2007, 4:05 AM
I have a relatively large menu which takes quite some time to render due to a even larger submenu. This of course results in a slow-down in response when hovering different menu items, since the widget still tries to render previous item.

In order to fix this, you could mimic the behavior of the windows menu, which delays it's rendering of submenus.


// private
activate : function(autoExpand){
if(Ext.menu.Item.superclass.activate.apply(this, arguments)){
this.allowShow = true;
this.focus();
if(autoExpand){
this.showProcess = this.expandMenu.defer(800,this);
}
}
return true;
},
// private
deactivate : function(){
Ext.menu.Item.superclass.deactivate.apply(this, arguments);
clearTimeout(this.showProcess);
this.allowShow = false;
this.hideMenu();
},

// private
expandMenu : function(autoActivate){
if(!this.disabled && this.menu && this.allowShow){
if(!this.menu.isVisible()){
this.menu.show(this.container, this.parentMenu.subMenuAlign || "tl-tr?", this.parentMenu);
}
if(autoActivate){
this.menu.tryActivate(0, 1);
}
}
}I've added a delay to the expandMenu function, and a check to see if the menu is allowed to show.

Maybe add somekind of show delay feature to the widget. :)