PDA

View Full Version : update display...



Molamini
17 Mar 2009, 11:28 AM
Hello,
I have searched through the forums trying to find a way to 'refresh' or 'update' the display of a Panel object. The code below is an example of me trying to do such a thing and failing.

Any suggestions?

Thanks!!!
Molamini





var SillyClass = function(config)
{
Ext.apply(this,
{
width: 300,
height: 300
});
SillyClass.superclass.constructor.apply(this, arguments);
this.value = config.value || 0;

}
Ext.extend(SillyClass, Ext.Panel,
{
onRender: function(e)
{
SillyClass.superclass.onRender.apply(this, arguments);
this.html=" value:" + this.value;
},

///vvvvvvvvvvvvv problem in this method vvvvvvvvvvvvvvvvvvv
setValue: function(value)
{
this.value = value;
//how do I force an onRender?
this.getEl().getUpdater().refresh();
;
}
///^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
});
Ext.onReady(function()
{
var sillyClass = new SillyClass(
{
title:'SillyClass 1',
renderTo: document.body,
width: 300,
height: 300,
value: 7
});
Ext.Msg.alert(sillyClass.value);
sillyClass.setValue(30);
// never have 2 consecutive alerts
// -- the thread does not block.
Ext.Msg.alert(sillyClass.value);
});

17 Mar 2009, 2:15 PM
this.el.update('Some Html ')

kt_saran
17 Mar 2009, 2:21 PM
Hi

Any one can tell me how to post public message to the forum. I am seeing only private message option.

Thanks
Saran

17 Mar 2009, 2:26 PM
http://tdg-i.com/img/screencasts/2009-03-17_1825.png

Molamini
17 Mar 2009, 3:11 PM
jgarcia,


Excellent!!! I swear I searched over and over for this solution.

Thanks!

Here is a working example




var SillyClass = function(config)
{
Ext.apply(this,
{
width: 300,
height: 300
});
SillyClass.superclass.constructor.apply(this, arguments);
this.setValue(config.value || 0);

}
Ext.extend(SillyClass, Ext.Panel,
{
setValue: function(value)
{
this.value = value;
this.el.update("HTML to update the display of value:" + this.value);
}
});
Ext.onReady(function()
{
var sillyClass = new SillyClass(
{
title:'SillyClass 1',
renderTo: document.body,
width: 300,
height: 300,
value: 7
});
Ext.Msg.alert(sillyClass.value);
sillyClass.setValue(30);
Ext.Msg.alert(sillyClass.value);
});