PDA

View Full Version : Problem updating components.



toddgeist
11 Jul 2010, 10:27 AM
Hello,

This may have nothing to do with Ext Designer... but this is how I set the project up so I thought it best to post it here

still learning... In the code below I am just trying to change the label of the button that fires the click event. This is just an attempt to better understand how things are wired. I have setup a click handler that does respond to the click but it does not update the text of the button. Or rather it doesn't appear to. nothing happens on screen.

I have a feeling that there is something I must do to cause the component to "redraw", but I can't find it. I have searched for "redraw", and related terms. "update" is quite clearly not it. In flex there is something like invalidateDisplay which cause the component to redraw on the next loop, but I can't find anything similar.

What am I missing?

Thanks
Todd

"clearButton" is the autoRef to the button setup with Designer. The button is an toolbar.


Artisan = Ext.extend(ArtisanUi, {
initComponent: function() {
Artisan.superclass.initComponent.call(this);
this.clearButton.on('click', this.clicked, this)
},

clicked : function(button, event) {
button.text = 'new label';
}
});

toddgeist
11 Jul 2010, 3:57 PM
Solved

just me not knowing what I am doing. To set the text of a button. Then use button.setText();

jarrednicholls
12 Jul 2010, 6:57 AM
Todd,

That's correct...setting a javascript object property directly cannot be "caught" by any mechanism in today's standard ECMAScript implementations within browsers. So anytime you need to "set" some property, you'll find it as a set<Prop>() function generally. Under the hood, the text is stored and the HTML is updated inside of the button.