-
19 Dec 2012 4:35 AM #1
Unanswered: event it does not work after changing the view
Unanswered: event it does not work after changing the view
hello
I have a simple view and I added a listener painted to change the style from the HTML data load with JSONP
for the first time the event works very well but after changing it to work anymore.
I change the view with this syntax
please help me I'm BlockedCode:this.bioview = Ext.create('app.view.Bioar'); Ext.Viewport.remove(Ext.Viewport.getActiveItem(), true); Ext.Viewport.setActiveItem(this.bioview);
-
19 Dec 2012 5:56 AM #2
Where's the listener code? What is the context that this snippet is run in? Please post more code/details.
BriceBrice Mason
Front End Developer
Modus Create
@bricemason
bricemason.com
Sencha Touch Screencasts
Vimeo - Sencha Touch Channel
Github Projects:
Sencha Cordova Builder enables the automatic creation, building, and running of PhoneGap (Cordova) projects with Sencha Touch.
Am I Sencha Touch Ready? checks your system to determine what you need to do to start Sencha Touch development. If you're having trouble getting up and running, try this out.
Sencha Tools Bridge allows Sencha SDK Tools to co-exist with Sencha Cmd on the same system.
-
19 Dec 2012 6:57 AM #3
thank your reply
this code of listener
setting.js
the listener works well at the beginning but when I change the view and this view has Comeback I it does not work(: |Code:html:['<div id="c1" class="chek">Hair</div><div id="c2" class="chek">Fashion</div><div id="c3" class="chek">Makeup</div><div id="c4" class="chek">Skin Care</div>'], listeners: { painted: function() { //this is what I want Ext.get('c1').setStyle('color','#B08D56'); Ext.get('c1').setStyle('background-image','url(resources/images/case-coche.png)'); }}
-
19 Dec 2012 12:39 PM #4
I have a couple of general opinions, first being that you should reconsider setting inline styles. Opting to add/remove css classes is almost always a better option. Second I would also reconsider sprinkling those ids in those divs. You have element and component query capabilities that will be able to find what you need for a variety of selectors. However since I'm still not entirely sure what your app looks like or what the intention of it is, here is a snippet containing my best assumption of your view:
I used the code that you posted but modified it to have the element query be contextual and just search down the tree for the element you were after.Code:Ext.define('app.view.Bioar', { extend: 'Ext.Component', xtype: 'bioar', config: { html: '<div id="c1" class="chek">Hair</div><div id="c2" class="chek">Fashion</div><div id="c3" class="chek">Makeup</div><div id="c4" class="chek">Skin Care</div>', listeners: { painted: function(el, opt) { el.down('#c1').setStyle({ color: '#B08D56', backgroundImage: 'url(resources/images/case-coche.png)' }); } } } });
I would need a better idea of when/how your views are switching to understand what the problem with the code is. Are you using a controller? What's that look like? Post more code if you can.
BriceBrice Mason
Front End Developer
Modus Create
@bricemason
bricemason.com
Sencha Touch Screencasts
Vimeo - Sencha Touch Channel
Github Projects:
Sencha Cordova Builder enables the automatic creation, building, and running of PhoneGap (Cordova) projects with Sencha Touch.
Am I Sencha Touch Ready? checks your system to determine what you need to do to start Sencha Touch development. If you're having trouble getting up and running, try this out.
Sencha Tools Bridge allows Sencha SDK Tools to co-exist with Sencha Cmd on the same system.


Reply With Quote