PDA

View Full Version : Migration 4.0.7->4.1 causing "comp.getItemId is not a function"



Follon
15 Jun 2012, 5:04 AM
Hi, today I have tryed to migrate from extjs 4.0.7 to 4.1.

It results that my app doesn't work anymore.

Here is my code :


Ext.define("Main.component.graph.mcqsearch.Button", {
extend:'Ext.button.Button',
requires:'Ext.dd.DragZone',
scale:'large',
action:'',
cls:'button-draggable',
width:170,
constrain:true,
listeners:{
render:
function(v){
v.dragZone = Ext.create('Ext.dd.DragZone', v.getEl(), {
getDragData: function(e) {
var sourceEl = e.getTarget('.button-draggable'), d;
if (sourceEl) {
d = sourceEl.cloneNode(true);

d.id = Ext.id();
d.style.top = 0;
return v.dragData = {
sourceEl: sourceEl,
repairXY: Ext.fly(sourceEl).getXY(),
ddel: d,
name : v.text,
image : v.icon,
type : 'menu'
};
}
},
getRepairXY: function() {
return this.dragData.repairXY;
}
});

}
}
});
Ext.define("Main.component.graph.mcqsearch.McqMenuDragZone", {
extend: "Ext.panel.Panel",
requires:['Main.component.graph.mcqsearch.Button','Ext.menu.Menu'],
layout: {
type: 'fit',
pack: 'start',
align: 'stretch'
},
defaults: {border: false},
initComponent: function(){
var menuItems = [ Ext.create('Main.component.graph.mcqsearch.Button',{icon:'stuff/resources/images/menu1.png',text:'Menu1'}),
Ext.create('Main.component.graph.mcqsearch.Button',{icon:'stuff/resources/images/menu2.png',text:'Menu2'}),
Ext.create('Main.component.graph.mcqsearch.Button',{icon:'stuff/resources/images/menu3.png',text:'Menu3'})];


this.items = [{
xtype: "menu",
autoScroll:true,
floating: false,
border: false,
items: [menuItems]
}];
this.callParent();
}
});


FireBug gives me this error : comp.getItemId is not a function

return comp.getItemId();

And Chrome this one :
Uncaught TypeError: Object [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] has no method 'getItemId'

It appears that it blocks at "this.callParent()";

Could someone help me, please ?

Follon
15 Jun 2012, 7:01 AM
So, I found the solution.

items:[menuItems]

has to be replace by

items:menuItems

I still have some problems with the dragData, but I should find.

iNes14
14 Nov 2012, 2:45 AM
Hello!

I have same problem with grid drag and drop. I can't do model.getParamId() on the drop model... Have you find a solution ?