Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7510281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:11:07+00:00 2026-05-29T23:11:07+00:00

I have a viewport with two items : an authentication form and a tab

  • 0

I have a viewport with two items : an authentication form and a tab panel.
In the initComponent method of this viewport I call a function that checks if the user ever entered his login and password.

If not, the authentication form shows up and when he clicks on the log in button the tab panel shows up.

But if, there are stored credentials, I want the app automatically switch to the tab panel.

This is how I wanted to do it :

app.views.Viewport = function (config) {
    Ext.apply(this, config);

    this.user = null; // Setter par le checkLogin !

    this.bottomTabs = new Ext.TabPanel({
        tabBar: { 
            dock: 'bottom',
            layout: { pack: 'center' } 
        }, 
        items:[...],                             
        layout: 'fit',
        cardSwitchAnimation: false,
    });

    this.userLogin = new app.views.UserLogin();

    //constructor
    app.views.Viewport.superclass.constructor.call(this, {
        fullscreen: true,
        layout: 'card',
        cardSwitchAnimation: 'fade',
        items: [
            this.userLogin,
            this.bottomTabs
        ]
    });

};

Ext.extend(app.views.Viewport, Ext.Panel, {
    initComponent: function () {
        app.views.Viewport.superclass.initComponent.call(this);
        this.initialCheck();
    },

    initialCheck: function(){
        console.log('init');
        var credentials = window.localStorage.getItem("neroApp_credentials");
        if (credentials == null || credentials == "reset") {
            console.log('no creds');
            this.setActiveItem(this.userLogin); // ***
        }
        else {
            console.log('creds');
            Ext.Ajax.defaultHeaders = {'Authorization':"Basic " + credentials};
            this.checkLogin();
        }
    },

    checkLogin: function () {
        console.log('checkLogin');
        Ext.Ajax.request({
            url: app.stores.baseAjaxURL + '&jspPage=%2Fajax%2FgetUser.jsp',
            scope: this,
            success: function(response, opts) {
                console.log('success');
                var user = Ext.decode(response.responseText);
                this.user = user;
                this.actualites.actualitesList.refreshActu(this.user, parseInt(window.localStorage.getItem("newsPerLoad")));
                this.setActiveItem(this.bottomTabs, { type: 'fade', duration: 500 });
            },
            failure: function(response, opts) {
                console.log('failure');
            }
        });
    },

    resetLogin: function() {
        window.localStorage.setItem("neroApp_credentials", "reset");
        Ext.Ajax.defaultHeaders = {'Authorization':"Basic RESET_Credentials"};
    }

});

But I’m getting a white screen on startup because of the * line. I’m guessing it is fired too early maybe because the setActiveItem in the checkLogin function works fine.

Anybody has an idea why this setActiveItem fires an error ?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:11:08+00:00Added an answer on May 29, 2026 at 11:11 pm

    Ok, I didn’t find out what the problem was even though I’m guessing that firing the setActiveItem within the initComponent isn’t good practice, but I’m finally got it working by setting the active item like so :

        initialCheck: function(){
            console.log('init');
            var credentials = window.localStorage.getItem("neroApp_credentials");
            if (credentials == null || credentials == "reset") {
                this.activeItem = this.userLogin;
            }
            else {
                this.activeItem = this.bottomTabs;
                Ext.Ajax.defaultHeaders = {'Authorization':"Basic " + credentials};
                this.checkLogin();
            }
        },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i have a viewport with two region west and center west holds panel
I have a footer that is fixed to the bottom of the viewport. I
I defined two panels in viewport: a main panel which is non-floating, the other
I have two separate views that both show multiple lists of values. Both views
I have a ViewPort that I want to open a number of tabs. One
I have a structure of this type (Ext 3.3.1): var page = new Ext.Viewport({
I use this meta-tag <meta name=viewport content=width=device-width, initial-scale=1.0, user-scalable=no> And I have a text
I have an HTML page that for the sake of this question looks like
I'm working on a website and have been using absolute positioning, since the viewport
I'm trying to have a minimap display with a draggable viewport below a chart.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.