Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: how to change title text Ext.navigation.view's navigationBar?

  1. #11
    Sencha User
    Join Date
    Jun 2011
    Location
    Switzerland
    Posts
    16
    Vote Rating
    0
      0  

    Default Quick and dirty way

    As already said.. this is not the way how you should do it but it worked for me:
    Code:
    setTitle: function(title)
        {
            this._navigationBar.setTitle(title);
        }
    For some reason the back-button is not shown anymore if you do a this.getNavigationBar().setTitle(title) but I had no time to further investigate.

  2. #12
    Sencha User
    Join Date
    Jul 2013
    Posts
    4
    Vote Rating
    0
      0  

    Default

    1. Init navigation view component with some controller or query:

    Code:
    var nav = Ext.ComponentQuery.query('<selector suitable for your navigation view>')[0];
    2. Put new title and appropriate width:

    Code:
    nav.getNavigationBar().down('title').setHtml("Hello");
    nav.getNavigationBar().down('title').setWidth(100);

  3. #13
    Sencha User mcelotti's Avatar
    Join Date
    Nov 2013
    Posts
    63
    Answers
    1
    Vote Rating
    8
      0  

    Default

    Code:
    this._navigationBar.setTitle(title);
    This works but we do not have title history, ie: if you go back with nav button the navigationview has no title.
    The problem disappears if you set title at push time, but this is not always possible.
    Is there a clean way to set navigationview's title dynamically without loosing title's "history" ?

  4. #14
    Sencha User mcelotti's Avatar
    Join Date
    Nov 2013
    Posts
    63
    Answers
    1
    Vote Rating
    8
      0  

    Default

    Ok, found a workaround that is not too bad: use "this._navigationBar.setTitle(title);" to set nav title at any time, then set up a "titleHistory : {}" to save your titles according to nav getInnerItems() count.
    When you get a remove event you read the current getInnerItems() count to fetch previous title in titleHistory and update _navigationBar.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

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