Hybrid View

  1. #1
    Sencha User
    Join Date
    Jun 2010
    Location
    France
    Posts
    44
    Vote Rating
    0
    Answers
    2
    ludm is on a distinguished road

      0  

    Default Unanswered: Problem with destroy an create again

    Unanswered: Problem with destroy an create again


    Hello,

    I have a view called Cave_V,
    When I press a button, it creates the view and then I have a button in this view to close it. I want to destroy it for memory usage, but I need to create again later.

    Problem
    Then I Create again, the controller doesn't work, I don't understand why.

    Here is the controller
    Code:
    Ext.define('Cave.controller.Main_C', {
        extend: 'Ext.app.Controller',
    
    
        config: {
            refs: {
                ajouterButton: "#Ajouter",
                fermerCaveBut: "#fermerCaveB",
                CaveV: "#Cave1",
                Casier:"#Casier1",
            },
            control: {
                 ajouterButton: {
                             tap: 'afficheCave'
                },
            fermerCaveBut: {
                             tap: 'fermerCave'
                },
            },
        },
    
    
        afficheCave: function() {
           // instanciation de la cave
            var maCave= Ext.create('Cave.view.Cave_V');
            maCave.afficher();
            monCasier=this.getCasier();
            monCasier.remplir();
        },
        fermerCave: function() {
            var maCave=this.getCaveV();
            maCave.fermer();
            console.log("fermer");
        }
    });
    Here are the two function called :

    afficher:function(){

    Ext.Viewport.add(this);
    this.show();
    },
    fermer:function(){
    this.destroy();
    }
    What is wrong ?

  2. #2
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    827
    Vote Rating
    55
    Answers
    84
    jerome76 has a spectacular aura about jerome76 has a spectacular aura about jerome76 has a spectacular aura about

      0  

    Default


    So you Ext.create(...); the view after destroying it? All I see is that you use add(this)​ and this.show()

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Location
    France
    Posts
    44
    Vote Rating
    0
    Answers
    2
    ludm is on a distinguished road

      0  

    Default


    Yes there is :

    Code:
    var maCave= Ext.create('Cave.view.Cave_V');
    (in the controller)

Tags for this Thread