-
25 Apr 2013 7:40 AM #1
Unanswered: Items not rendered after build
Unanswered: Items not rendered after build
I have a really simple app : http://www.senchafiddle.com/#AREBJ . It consists of a view, which displays some links. After clicking each of them, a popup with target value appears. Everything works fine before building the app, but after building the links are not displayed at all. For showing links I'm using the DataView component. Previously I've tried tackling it with Ext.Component, but dunno why events were not fired when any of the items was tapped on. Here's the second version of IconsScreen view which I'd prefer to use, but without events it's useless :
I'm also attaching a buildable version. Sorry for hosting on MEGA but it's too big to attach via forum : https://mega.co.nz/#!kEZiCTQT!ckFxSQ...9MVy8hynjdPHQ8Code:Ext.define('ShopGun.view.IconsScreen', { extend: 'Ext.Component', xtype: 'icons-screen', require: [ 'ShopGun.store.MainMenu' ], config: { tpl: new Ext.XTemplate('<ul class="menu-icons-list">', '<tpl for=".">', '<li class="icon">', '<a target="{url}" style="background: url({icon})">', '</a>', '<span class="icon-text">{name}</span>', '</li>', '</tpl>', '</ul>' ), store : Ext.create('ShopGun.store.MainMenu'), data : [], listeners : { painted : function(){ console.log('painted'); this.onIconTap(); } } }, initialize : function() { var storeData = this.getStore().getRange(), tplData = []; Ext.Array.each(storeData, function(item){ tplData.push(item.getData()); }); this.setData(tplData); this.element.on({ scope : this, delegate : 'a', tap : 'onIconTap' }); this.callParent(); }, onIconTap : function(e, t) { this.fireEvent('icontap', e, t); } });Using ExtGantt / ExtScheduler from Bryntum ? I can help you integrate and implement it.
-
27 Apr 2013 5:56 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
Two things I first see that I don't like is your creating instances as configs. For instance, the tpl should just be a string or array:
Code:tpl : ''.conat( '<ul class="menu-icons-list">', '<tpl for=".">', '<li class="icon">', '<a target="{url}" style="background: url({icon})">', '</a>', '<span class="icon-text">{name}</span>', '</li>', '</tpl>', '</ul>' ),Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
29 Apr 2013 3:20 AM #3
Unfortunately this doesn't solve the problem, and events are still not fired in the built version :/ Moreover moving tpl from config to class properties ends in the icons not renederd at all.
Using ExtGantt / ExtScheduler from Bryntum ? I can help you integrate and implement it.
-
3 May 2013 7:25 AM #4
After some more fighting
After some more fighting
I've found that assigning a normal js event handler works without any problems. Also I've thought that maybe delegation is the issue here, but no. Assigning any handler to 'this.element' doesn't work. I've tried with different components, List, dataView, Carousel, Component and nothing works after building. Something's seriously wrong here but I cannot see what. What is this builder of yours doing that no Ext event handler works ?
Code:initialize : function() { (...) this.callParent(); this.element.on({ scope : this, tap : 'onIconTap' }); var z = this.element.select('.icon a').elements[0].addEventListener('click', function(){ me.onIconTap(); }); }, onIconTap : function(e, t) { console.log('ICONTAP'); }Using ExtGantt / ExtScheduler from Bryntum ? I can help you integrate and implement it.
-
3 May 2013 8:21 AM #5
.
.
After even more debugging I've found, that elements in dom have completely different id numbers which means they're added in a different order. The icons element that in a non-build version is added the last (as it should) in the build version has id #1. Any ideas what can cause this ?
Using ExtGantt / ExtScheduler from Bryntum ? I can help you integrate and implement it.


Reply With Quote