PDA

View Full Version : Object doesn't support property or method 'onAdded'



m_aboukaff
24 Jul 2013, 4:35 AM
I developed an asp.net application using Ext JS 4, Later, I tried to upgrade for Ext 4.2 which support right to left. I changed only javascript source (src) in my aspx page to new release, I have the following error "Object doesn't support property or method 'onAdded'".

slemmon
24 Jul 2013, 12:18 PM
Are you using a call or override to onAdded in any of your custom classes?

m_aboukaff
24 Jul 2013, 11:40 PM
Error Details:

SCRIPT438: Object doesn't support property or method 'onAdded'
ext-all-debug.js, line 37529 character 17



The following code causes this error:


Ext.Ajax.request({
url: 'portal/Dashboard/Predefined/FRM_DynamicAppMenu.aspx',
success: function (response) {
if (response.responseText.length > 0) {
appMenuItems = eval(response.responseText);
if (appMenuItems.length > 0) {
var appMenu = Ext.create('Ext.menu.Menu', {
id: 'appMenu',
style: {
overflow: 'visible'
},
items: [appMenuItems]});
});
.
.
.
remaining of my code.
.
.
.

m_aboukaff
25 Jul 2013, 12:48 AM
Are you using a call or override to onAdded in any of your custom classes?

No. I'm using " ext-4.2.0.663/ext-all-debug.js "

slemmon
25 Jul 2013, 1:58 PM
I tried to reproduce the issue using 4.2.0 and ext-dev and ext-all-debug using the below test case and sample response and didn't see an error. Can you modify my test case / sample data to reproduce the issue?

client code


Ext.Ajax.request({
//url: 'portal/Dashboard/Predefined/FRM_DynamicAppMenu.aspx',
url: 'data/json.json',
success: function (response) {
if (response.responseText.length > 0) {
var appMenuItems = Ext.JSON.decode(response.responseText);
if (appMenuItems.length > 0) {
var appMenu = Ext.create('Ext.menu.Menu', {
id: 'appMenu',
style: {
overflow: 'visible'
},
items: [appMenuItems]
});
}
}
}
});


server response


{
"success": true,
"data": [{
"company": "Sencha"
}]
}

m_aboukaff
27 Jul 2013, 11:12 PM
Thanks Slemmon for your help. The error has solved using the following code:
Ext.Ajax.request({
url: 'portal/Dashboard/Predefined/FRM_DynamicAppMenu.aspx',
success: function (response) {
if (response.responseText.length > 0) {
appMenuItems = eval(response.responseText);
if (appMenuItems.length > 0) {
var appMenu = Ext.create('Ext.menu.Menu', {id: 'appMenu'});
Ext.each(appMenuItems,function(item){ appMenu.add(item); });
.
.
.
remaining of my code
.
.
.