Updating window title in js

  1. #1

    Updating window title in js

    Hi there,

    I am trying to update the title to the current window using js during the KeyUp event of a ext:TextField. The changes seem to have taken effect when I slap up a js alert box displaying the new title after I set the new title. However visually, the window title doesn't appear to be updating.

    I have a Master page handling the outer framework/branding and the content page doing the work. Would that be a problem??

    Any ideas as to what I am doing wrong would be appreciated. Thanks.


    function updateWinTitle()
    
    
    { 
    
    
    var mywindow = Ext.getCmp("<%=ToolWindow1.ClientID %>");
    
    
    var ctlSource = Ext.getCmp("<%=TextField5.ClientID %>");
    
    
    
    
    
    mywindow.Title = "[" + ctlSource.getValue() + "]";
    
    
    }
  2. #2

    RE: Updating window title in js

    I think you have to use window.setTitle('New Title'); to update the DOM.
  3. #3

    RE: Updating window title in js

    @dbassett74 - I had a code snippit ready to post as well, thanks for posting your response.

    @principal_X - As mentioned above, you use the .setTitle function client-side. You can also reference an instance of each control by its .ClientID property. There is no need to use .getCmp.

    Example

    var updateWinTitle = function ()
    { 
        <%=ToolWindow1.ClientID %>.setTitle("[" + <%=TextField5.ClientID %>.getValue() +"]");
    };
    http://extjs.com/deploy/dev/docs/?cl...ember=setTitle

    Hope this helps.

    Geoffrey McGill
    Founder
  4. #4

    RE: Updating window title in js

    *Thank you. *That worked.
  5. #5

    RE: Updating window title in js

    I do have another question relating to this... plase advise me if I need to start a new topic.

    My app is now setup is that for each click of a menu item, I am creating a new instance of Ext.Window like this:

    function createWindow(wintitle,myurl) {           
        var window = new Ext.Window({                
            modal: false,                
            maximizable: true,                
            title: wintitle,                
            autoLoad:{
                maskMsg:"Loading...",
                showMask:true,
                mode:"iframe", 
                url:myurl
            },                
            width:880,                
            height:640,                
            bodyStyle: 'background-color: #fff;'            
         });            
         
         window.show();        
    }
    The "myurl" I a loading inside that window is another .aspx page in the project.

    I am trying to change the window title of the Ext.Window object. Same scenario as the original post, but the Ext.TextField object is in the .aspx page I am loading into the Ext.Window instance.

    How do I reference the Ext.Window in javascript from the .aspx page I am loading inside it?

  6. #6

    RE: Updating window title in js

    *I figured it out. *Thanks.

Similar Threads

  1. [CLOSED] Updating the title of a destop window
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 13, 2012, 6:50 AM
  2. [CLOSED] Updating window content
    By borja_cic in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 15, 2011, 6:04 PM
  3. [CLOSED] Updating window size during DirectEvent
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 13, 2010, 9:42 PM
  4. Dynamic window title
    By phillipl in forum 1.x Help
    Replies: 3
    Last Post: Dec 16, 2009, 6:03 AM
  5. Window Title Question
    By bruce in forum 1.x Help
    Replies: 3
    Last Post: Mar 09, 2009, 5:21 AM

Posting Permissions