PDA

View Full Version : Uncaught TypeError: Cannot read property 'data' of undefined



bee
24 Jun 2011, 1:29 AM
Hi,

I am developing one application , application works fine but throws an exception that Uncaught TypeError: Cannot read property 'data' of undefined , how can I avoid this error, please let me know.

skirtle
24 Jun 2011, 5:57 AM
It could be any one of a million things. You haven't posted any code or given us a hint about what you were doing at the time.

Make sure you're using ext-all-debug.js and then use a debugger like Firebug or the Chrome Developer Tools to view the associated stacktrace. It should give some clue what it was doing at the time. View the entries in the stacktrace, if possible insert suitable breakpoints so you can catch it before it blows up the next time.

If you still can't figure out what the problem is then post your findings here.

vinothram
23 Nov 2011, 5:00 AM
Hello Bee,

can you able to fix this? If so kindly let me know the solution.

Thanks in advance.
Vinoth


Hi,

I am developing one application , application works fine but throws an exception that Uncaught TypeError: Cannot read property 'data' of undefined , how can I avoid this error, please let me know.

yalster
27 Apr 2012, 5:18 AM
Hello all. I am also facing the same problem. I am using Sencha Architect 2 btw.

I have a grid panel with a paging toolbar. Then I have a controller which has a selectionchange method. So when a user clicks on a row in the gridpanel the data of the row shows in a tab panel. After that the paging toolbar does not work anymore. When you click on an arrow the app doesn't update the grid. The funny thing is when you click on the arrow another time the grid panel gets updated again but it skips the next page and jumps directly to the page after e.g. from page 1 to page 3. Here's the code of the controller.


Ext.define('a2web.controller.ReklamationenController', {
extend: 'Ext.app.Controller',

views: [
'Main'
],

refs: [
{
ref: 'RightContainer',
selector: '#RightContainer'
}
],

onGridpanelSelectionChange: function(tablepanel, selections, options) {
this.getRightContainer().down('#ReklDetails').update(selections[0].data);
this.getRightContainer().down('#ReklDetails2').update(selections[0].data);
},

init: function() {
this.control({
"gridpanel": {
selectionchange: this.onGridpanelSelectionChange
}
});

}

});


Here's the code of the view:

Ext.define('a2web.view.Main', {
extend: 'Ext.container.Viewport',
alias: 'widget.main',

layout: {
align: 'stretch',
type: 'hbox'
},

initComponent: function() {
var me = this;

Ext.applyIf(me, {
items: [
{
xtype: 'panel',
width: 250,
autoScroll: false,
activeItem: 0,
collapseDirection: 'left',
collapsed: true,
collapsible: true,
title: 'a2web',
items: [
{
xtype: 'button',
width: 250,
text: 'Reklamationen'
},
{
xtype: 'button',
id: 'ReklamationErfassen',
width: 250,
text: 'Reklamation erfassen'
}
]
},
{
xtype: 'container',
frame: true,
id: 'RightContainer',
layout: {
align: 'stretch',
type: 'vbox'
},
flex: 1,
items: [
{
xtype: 'gridpanel',
id: 'ReklGrid',
width: 820,
autoScroll: false,
title: 'Reklamationen',
enableColumnHide: false,
enableColumnMove: false,
store: 'Reklamationen',
flex: 1,
columns: [
{
xtype: 'gridcolumn',
width: 80,
dataIndex: 'ReklDatum',
text: 'Datum'
},
{
xtype: 'gridcolumn',
width: 250,
sortable: false,
dataIndex: 'ReklText',
text: 'Text'
},
{
xtype: 'gridcolumn',
width: 150,
sortable: false,
dataIndex: 'ReklStrasse',
text: 'Strasse'
}
],
viewConfig: {
cls: '',
id: 'ReklGridView'
},
dockedItems: [
{
xtype: 'pagingtoolbar',
frame: false,
maintainFlex: false,
afterPageText: 'von {0}',
beforePageText: 'Seite',
displayInfo: true,
displayMsg: 'Datensatz {0} - {1} von {2} ',
emptyMsg: 'Keine Daten zum Anzeigen vorhanden',
firstText: 'Erste Seite',
lastText: 'Letzte Seite',
nextText: 'Nächste Seite',
prevText: 'Vorherige Seite',
refreshText: 'Aktualisieren',
store: 'Reklamationen',
dock: 'bottom'
}
]
},
{
xtype: 'tabpanel',
id: 'ReklContainer',
activeTab: 0,
flex: 1,
items: [
{
xtype: 'panel',
layout: {
align: 'stretch',
type: 'vbox'
},
title: '1 - Details',
items: [
{
xtype: 'panel',
id: 'ReklDetails',
tpl: [
'{ReklDatum} - {ReklStrasse}'
],
flex: 1
}
]
},
{
xtype: 'panel',
layout: {
align: 'stretch',
type: 'vbox'
},
title: '2 - Details',
items: [
{
xtype: 'panel',
id: 'ReklDetails2',
tpl: [
'{ReklText}'
],
flex: 1
}
]
}
]
}
]
}
]
});

me.callParent(arguments);
}

});

Any help would be greatly appreciated

willigogs
27 Apr 2012, 8:55 AM
This is the EXTJS 3.x forum. You may need to repeat your question in the EXTJS 4.x forum :)

yalster
27 Apr 2012, 9:39 AM
Allright, will do so. Thanks ;)