View Full Version : Ext.menu.Adapter issues
Bobrovnik
18 Aug 2009, 7:36 AM
Hi, I am not sure that I write in right forum section, so if I am wrong please apologise me.
Now I am trying to move current application from Ext 2.0 to Ext 3.0. Everything is working fine, except plugin Ext.ux.FileTreeMenu. Firebug throws an exception "Ext.menu.Adapter is not a constructor" at line
new Ext.menu.Adapter(new Ext.ux.UploadPanel(uploadPanelConfig), {
As I understand in Ext 3 there is no Ext.menu.Adapter and every menu item is a container, but in this case how should I use Ext.ux.UploadPanel here?
Thanks for help
Condor
18 Aug 2009, 7:42 AM
An Ext.menu.Adapter wrapper is no longer needed. Include the component directly as one of the menu items.
ps. You might need to set forceLayout:true on the component to make it show up.
Bobrovnik
18 Aug 2009, 8:03 AM
Thanks for reply Condor, I made correction that you said, but now I have an error in other jsakalos plugin Ext.ux.FileTreePanel "this.uploadPanel is undefined" at line
this.contextmenu = new Ext.ux.FileTreeMenu(config);
this.contextmenu.on({click:{scope:this, fn:this.onContextClick}});
this.uploadPanel = this.contextmenu.getItemByCmd('upload-panel').component;
this.uploadPanel.on({ beforeupload:{scope:this, fn:this.onBeforeUpload} ,
allfinished:{scope:this, fn:this.onAllFinished}
});
As I understand it is trying to find item with parametr cmd = 'upload-panel' and return current component. I am not sure why it is not finding it. If turn on firebug and look on items.items array I see item with cmd = 'upload-panel'
,getItemByCmd:function(cmd) {
var open;
var item = this.items.find(function(i) {
return cmd === i.cmd;
});
if(!item) {
open = this.items.find(function(i) {
return 'open' === i.cmd;
});
if(!open) {
return null;
}
item = open.menu.items.find(function(i) {
return cmd === i.cmd;
});
}
return item;
} // eo function getItemByCmd
Do you have any thought about that?
Bobrovnik
19 Aug 2009, 8:09 AM
After a day of trying to find out mistake. I have made some changes to FileTree extention, so now it works with Extjs 3.0 version.
In file Ext.ux.FileTreeMenu.js
var uploadPanelConfig = {
contextmenu:this
,buttonsAt:config.buttonsAt || 'tbar'
,singleUpload:config.singleUpload || false
,maxFileSize:config.maxFileSize
,enableProgress:config.enableProgress
};
should be replaced with
var uploadPanelConfig = {
hideOnClick:false
,cmd:'upload-panel'
,contextmenu:this
,buttonsAt:config.buttonsAt || 'tbar'
,singleUpload:config.singleUpload || false
,maxFileSize:config.maxFileSize
,enableProgress:config.enableProgress
};
,new Ext.menu.Adapter(new Ext.ux.UploadPanel(uploadPanelConfig), {
hideOnClick:false
,cmd:'upload-panel'
})
with
,new Ext.ux.UploadPanel(uploadPanelConfig)
in file Ext.ux.FileTreePanel.js
this.uploadPanel = this.contextmenu.getItemByCmd('upload-panel').component;
replace with
this.uploadPanel = this.contextmenu.getItemByCmd('upload-panel');
in file Ext.ux.FileUploader.js
record.set('form', form);
with
if(Ext.isIE)
record.set('form', undefined); // IE fix, without this it throws an exception
else
record.set('form', form);
in file Ext.ux.form.BrowseButton.js
this.buttonCt = this.el.child('.x-btn-center em');
with
this.buttonCt = this.el.child('.x-btn-mc em');
style: {
position: 'absolute',
cursor: 'pointer',
right: '0px',
top: '10px'
}
with
style: {
position: 'absolute',
cursor: 'pointer',
right: '0px',
top: Ext.isIE ? '10px' :'0px' // Also another IE fix
}
kiranpatil
5 Nov 2009, 4:21 AM
Hi,
After doing all the chages as per your post. Now I am getting following error.
menu.getEl() is undefined
chrome://firebug/content/blank.gif menu.showAt(menu.getEl().getAlignToXY(alignEl, 'tl-bl?'));\nExt.ux.FileTreePanel.js (line 1855
Also please tell me where to update following style lines you mentioned.
style: {
position: 'absolute',
cursor: 'pointer',
right: '0px',
top: Ext.isIE ? '10px' :'0px' // Also another IE fix
}
Thanks
Bobrovnik
5 Nov 2009, 4:39 AM
Hi,
After doing all the chages as per your post. Now I am getting following error.
menu.getEl() is undefined
chrome://firebug/content/blank.gif menu.showAt(menu.getEl().getAlignToXY(alignEl, 'tl-bl?'));\nExt.ux.FileTreePanel.js (line 1855
Also please tell me where to update following style lines you mentioned.
style: {
position: 'absolute',
cursor: 'pointer',
right: '0px',
top: Ext.isIE ? '10px' :'0px' // Also another IE fix
}
Thanks
I guess you could find all answers in original forum theme http://www.extjs.com/forum/showthread.php?t=29090
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.