Hybrid View

  1. #1

    Join Date
    Feb 2013
    Location
    India
    Posts
    12
    Vote Rating
    0
    chakra1234 is on a distinguished road

      0  

    Default Unanswered: How to Close viewport

    Unanswered: How to Close viewport


    I have a login(window) screen and menu which is viewport in my application. In my menu, I have LogOff button. On click of the button I wanted to remove the viewport and display the Login screen.
    I am using the below code in the LogOff button click event

    button.up('viewport').removeAll();
    var l=Ext.create('TestApp.view.Login');
    l.show();

    The above code while executing calls the "afterlayout" event of the viewport and gives error.

    Please help me to close the viewport.
    Thanks

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,800
    Answers
    358
    Vote Rating
    167
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    Is removing the items from the viewport what throws the error?

  3. #3
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106
    Vote Rating
    27
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    A much simpler approach is to use a separate page for Login. This page includes minimal ExtJs classes and performs a full-page submit; only if the user authenticates successfully do you forward them to the main index.html page which starts your actual application. Otherwise on authentication failure, they're redirected right back to the login page with a 'Bad login or password' error.
    Last edited by friend; 21 May 2013 at 9:15 AM. Reason: grammar

  4. #4
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,800
    Answers
    358
    Vote Rating
    167
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    I've been partial to the single-page approach myself, so there may be a couple of ways to skin this one. Another approach is to have your viewport have a card layout with two cards - one is the login and one is the app. Then you're not removing / destroying components at any stage, but rather just showing / hiding the card view you need the user to interact with at that moment.

  5. #5
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106
    Vote Rating
    27
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    I prefer a single-page solution also, but I was using Java/Spring MVC/Spring Security on the backend of a recent app. You couldn't preload any data stores since the user wasn't yet authenticated and didn't have permissions yet to call the pertinent URLs. This breaks a lot of the ExtJs MVC lifecycle for initialization/preloading of stores, so I ended up with the 'two page' approach, which worked really well in my case.
    Last edited by friend; 22 May 2013 at 6:19 AM. Reason: grammar

Thread Participants: 2

Tags for this Thread