Results 1 to 6 of 6

Thread: Rendering problem (Forms and Viewport)

  1. #1
    Sencha User Carlos Souza's Avatar
    Join Date
    May 2015
    Location
    Minas Gerais, Brazil.
    Posts
    29
    Answers
    1

    Default Answered: Rendering problem (Forms and Viewport)

    Hello to all!


    I'm having some problems with the rendering of my forms. I think it's something simple to solve, but I still haven't found a solution ...
    I'm doing a simple application with a login screen. After authentication, my application redirects the user to the system main screen (viewport).
    The problem is that when my viewport creates some form (Ext.create), the form does not render correctly, and when I logout the system (destroying the viewport) the forms created are not destroyed. I think this problem is related to the property "renderTo" of my forms.
    How to solve this problem?


    Thanks!

  2. If you add() the form to your "Main" component, it should get destroyed when "Main" is destroyed.

    https://fiddle.sencha.com/#fiddle/tde

    Thanks
    Joel

  3. #2
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Hi--

    If you are adding the forms as children of existing components, you shouldn't have to use renderTo. Can you share an example of the issue you're having in a test case (https://fiddle.sencha.com)? I'll be happy to test this along with you.

    Thanks!
    Joel

  4. #3
    Sencha User
    Join Date
    Feb 2015
    Posts
    8
    Answers
    1

    Default

    If you insert the form directly to your viewport you should use

    Code:
    viewport.add({xtype:'myForm'});
    of the defined component.

  5. #4
    Sencha User Carlos Souza's Avatar
    Join Date
    May 2015
    Location
    Minas Gerais, Brazil.
    Posts
    29
    Answers
    1

    Default

    Quote Originally Posted by joel.watson View Post
    Hi--

    If you are adding the forms as children of existing components, you shouldn't have to use renderTo. Can you share an example of the issue you're having in a test case (https://fiddle.sencha.com)? I'll be happy to test this along with you.

    Thanks!
    Joel
    I'm sorry, but I have difficulties to post a test case on the fiddle ... I'm still learning EXTJS 5 ...
    However, the code of my viewport is something like the code below:

    Code:
    /**Suppose that the user has already done the login to the system. 
    *The user then simply clicks the "Form Generator Button" button to create a form. 
    *With this form visible, the user performs the logout by clicking the "Logout" button
    */
    
    Ext.define('SGA.view.main.Main', {
        extend: 'Ext.container.Container',
        xtype: 'app-main',    
        plugins: 'viewport',    
        controller: 'main',    
        viewModel: {
            type: 'main'
        },
        layout: {
            type: 'border'
        },
        renderTo : document.body, 
        items: [        
        {            
            xtype: 'panel',
            title: "User Menu",
            region: 'north',            
            bodyBorder: true,
            buttonAlign: 'center',            
            frame: false,
            tbar: {
                xtype: 'toolbar',       
                items: [
                {
                    //Here, a simple button that creates the form "exampleForm"                
    
                    xtype: 'button',
                    text: 'Form Generator Button',
                    handler: function(){
                        
                      //Here, the form is created, supposing "autoShow:true".  
                     //This form is not rendering to the viewport!
    
                        Ext.create('exampleForm'); 
                        
                    }
    
    
                },
                {
                    xtype: 'button',
                    text: 'Logout',
                    handler: function(){
                        
                        //By clicking this button, the viewport is destroyed, and the user is redirected to the login form.
                        //The problem is, if "exampleForm"  is created, it is not destroyed along with the viwport.
                         
                        var MainView =  this.getView();
                        MainView.destroy();                        
                        Ext.widget('login'); //The user is redirected to the "login" form and the "exampleForm" is still visible!"
                        
                        
                    }
    
    
                },        
              ]
            } 
        }]
    });
    Could anyone help me with this problem? How to render the form "exampleForm" as a viewport child?
    Thank you in advance and sorry for my English.

  6. #5
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    If you add() the form to your "Main" component, it should get destroyed when "Main" is destroyed.

    https://fiddle.sencha.com/#fiddle/tde

    Thanks
    Joel

  7. #6
    Sencha User Carlos Souza's Avatar
    Join Date
    May 2015
    Location
    Minas Gerais, Brazil.
    Posts
    29
    Answers
    1

    Default

    Quote Originally Posted by joel.watson View Post
    If you add() the form to your "Main" component, it should get destroyed when "Main" is destroyed.

    https://fiddle.sencha.com/#fiddle/tde

    Thanks
    Joel
    Solved! Thank you!

Similar Threads

  1. Replies: 2
    Last Post: 15 Jan 2011, 5:48 AM
  2. Rendering Problem of Multi Column Forms in FF 3.5
    By kerbo in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 7 Jul 2009, 7:25 PM
  3. Viewport Rendering offset problem
    By Sesshomurai in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 8 Feb 2009, 11:55 AM
  4. Viewport rendering problem
    By blspider in forum Ext 2.x: Help & Discussion
    Replies: 13
    Last Post: 31 Aug 2008, 11:50 AM
  5. Viewport rendering problem
    By masuran in forum Ext 2.x: Help & Discussion
    Replies: 12
    Last Post: 5 Aug 2008, 11:43 PM

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
  •