Hybrid View
-
4 Mar 2012 11:37 PM #1
[4.1B3] Bug with initComponent method of dataview
[4.1B3] Bug with initComponent method of dataview
With dataview example taken from documentation, if initComponent method is added to a dataview, TypeError is thrown:
Upon execution above code throws following:Code:Ext.onReady(function() { Ext.define('Image', { extend: 'Ext.data.Model', fields: [ { name:'src', type:'string' }, { name:'caption', type:'string' } ] }); Ext.create('Ext.data.Store', { id:'imagesStore', model: 'Image', data: [ { src:'http://www.sencha.com/img/20110215-feat-drawing.png', caption:'Drawing & Charts' }, { src:'http://www.sencha.com/img/20110215-feat-data.png', caption:'Advanced Data' }, { src:'http://www.sencha.com/img/20110215-feat-html5.png', caption:'Overhauled Theme' }, { src:'http://www.sencha.com/img/20110215-feat-perf.png', caption:'Performance Tuned' } ] }); var imageTpl = new Ext.XTemplate( '<tpl for=".">', '<div style="margin-bottom: 10px;" class="thumb-wrap">', '<img src="{src}" />', '<br/><span>{caption}</span>', '</div>', '</tpl>' ); Ext.create('Ext.view.View', { store: Ext.data.StoreManager.lookup('imagesStore'), tpl: imageTpl, itemSelector: 'div.thumb-wrap', emptyText: 'No images available', renderTo: Ext.getBody(), // bug: plain initComponent causes throwing a TypeError initComponent: function() { this.callParent(); } }); });
Damir MuratCode:Uncaught TypeError: Cannot call method 'fill' of undefined Ext.define.refreshext-all-debug.js:59347 Base.implement.callParentext-all-debug.js:3609 Ext.define.refreshext-all-debug.js:100851 (anonymous function)ext-all-debug.js:59578 (anonymous function)
-
4 Mar 2012 11:45 PM #2Sencha - Community Support Team
- Join Date
- Nov 2007
- Location
- Helsingborg, Sweden
- Posts
- 2,454
- Vote Rating
- 48
Never use initComponent when instantiating a class, use it when _defining_ a class.
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote