Results 1 to 3 of 3

Thread: Problem with destroy an create again

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Jun 2010
    Location
    France
    Posts
    44
    Answers
    2
    Vote Rating
    1
      0  

    Default 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
    1,149
    Answers
    132
    Vote Rating
    100
      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
    Answers
    2
    Vote Rating
    1
      0  

    Default

    Yes there is :

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

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
  •