Results 1 to 5 of 5

Thread: update display...

  1. #1
    Ext JS Premium Member
    Join Date
    Feb 2009
    Posts
    28

    Default update display...

    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


    Code:
     
    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);
    });

  2. #2

  3. #3

    Default How to post public new message

    Hi

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

    Thanks
    Saran

  4. #4

  5. #5
    Ext JS Premium Member
    Join Date
    Feb 2009
    Posts
    28

    Default

    jgarcia,


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

    Thanks!

    Here is a working example

    Code:
    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);
    });

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •