Announcement

Collapse
No announcement yet.

[ANSWERED] How to access the current App Title

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [ANSWERED] How to access the current App Title

    How do I retrieve the app name of the current tab in Valence 3.2?

    I'm running a multilingual environment.

    - JP

  • #2
    JP,

    Example of getting the current applications text.

    Code:
            var getApplicationText = function(){
                var appId        = Ext.getUrlParam('app'),
                    appsRootNode = parent.Portal.getApplication().getStore('Apps').getRootNode(),
                    currentAppText;
    
                //find the current app in the portals apps tree store
                //
                appsRootNode.cascadeBy(function(rec){
                    if (rec.get('misc2') == appId){
                        currentAppText = rec.get('text');
                        return false;
                    }
                });
    
                if (!Ext.isEmpty(currentAppText)){
                    return currentAppText;
                } else {
                    Ext.Error.raise({
                        msg   : 'Could not find application record',
                        appId : appId
                    });
                }
                return null;
            }, appText;
    
            appText = getApplicationText();
    
            if (!Ext.isEmpty(appText)){
                console.log('Current Application Text : ', appText);
            }

    Comment


    • #3
      Thanks.

      Will this code still work in Valence 4.2?

      Comment


      • #4
        No, the apps store in 4.2 is no longer a tree store.

        Example of getting the current application text in 4.2:

        Code:
                var getApplicationText = function () {
                    var appId     = Ext.getUrlParam('app'),
                        appRecord = parent.Portal.getApplication().getStore('Apps').findRecord('appId', appId, 0, false, true, true);
        
                    if (!Ext.isEmpty(appRecord)) {
                        return appRecord.get('name');
                    } else {
                        Ext.global.console.warn('Could not find application record: ', appId);
                    }
                    return null;
                }, appText;
        
                appText = getApplicationText();
        
                if (!Ext.isEmpty(appText)) {
                    console.log('Current Application Text : ', appText);
                }

        Comment

        Working...
        X