Results 1 to 6 of 6

Thread: Tabpanel is not destroying while closing tab

  1. #1
    Sencha User
    Join Date
    Jun 2015
    Posts
    7

    Default Tabpanel is not destroying while closing tab

    HI! I'm migrating my app from extjs3 to extjs5, through extjs4.

    Is a complex app and I have some tabpanels and a menu.

    The menu opens a TabPanel with a gridPanel. If i choose a record and select edit record, this record is opened in a new tab on a panel with the form (...)

    The case is... If I close the gridPanel with all rows, this grid is being destroyed from DOM and the memory is flushed. (it's OK)

    But... If i close the tab with the form, neither the DOM object dissapears nor the object is removed from memory. (it's not OK)

    I checked all "closeActions" and "autoDestroy" configs but i can't find any error.

    Is there any known bug that causes it? Does anyone know how to fix it?

    I'm trying to prepare a sencha fiddle trying to find that bug on it and share it.

    Thanks!

    Edit: Fiddle: https://fiddle.sencha.com/#fiddle/t7q

    E
    dit 2: Little explain of fiddle:


    This is a dirty copy of the app, adapted to fiddle.

    The main code is on the files:
    FrameworkIntranet.js
    BasicForm.js
    ---

    When the app loads, it generates some layouts and menus (not working on fiddle), one layout is a tabpanel which will contain some forms of a lot of records.

    In the menu there are a lot of lists of records that you can open and if you open one, this will make a query to listMetaData to know the state of the form for u (can delete, can destroy, etc).

    Once form build, it will be added to panel and load data.

    On FrameworkIntranet.js:389 you can see how the panel is created and added to tapbanel and it have "closable: true, closeAction: "destroy"," configs added and still hidding while closing the tab.

  2. #2
    Sencha User yeghikyan's Avatar
    Join Date
    Mar 2009
    Location
    München
    Posts
    574
    Answers
    99

    Default

    May you reproduce it in fiddle?
    http://fiddle.sencha.com
    "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague." – Edsger W. Dijkstra

  3. #3
    Sencha User
    Join Date
    Jun 2015
    Posts
    7

    Default

    Quote Originally Posted by yeghikyan View Post
    May you reproduce it in fiddle?
    http://fiddle.sencha.com
    I'm on it. I did one but didn't save... Too big app.

    I'm doing other...

  4. #4
    Sencha User
    Join Date
    Jun 2015
    Posts
    7

    Default

    Quote Originally Posted by yeghikyan View Post
    May you reproduce it in fiddle?
    http://fiddle.sencha.com
    Well i did it:

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

    There is the core of the app with some functions. There is a lot of bugs and malfunctions but don't care.

    If you run it, you can see a tabpanel with a tab and a button inside TAB.

    When you click that button, another tab will open with a record (...) and crashes, but dont care.

    The "bug" is... If you close the second tab, this is not destroying like it should.

    After close the second tab, you can click again at the button to re-open it and you will see an error on console saying that cannot add duplicate ID. Why this ID wasn't deleted while tab close if I have closeaction: destroy?

  5. #5
    Sencha User yeghikyan's Avatar
    Join Date
    Mar 2009
    Location
    München
    Posts
    574
    Answers
    99

    Default

    In the method 'doOpenRecordForm' you have
    Code:
    var tabId = form + '-plainRecord-' + oid.replace(/[_|]/g, '-');
    it generates the same id for all the tabs. If you will change it so, that jeden tab will get unique id, it will not crash.
    Code:
    var tabId = form + '-plainRecord-' + oid.replace(/[_|]/g, '-') + Ext.id();
    P.S.
    it is better to avoid using of 'id' property and use 'itemId'.

    P.P.S.
    51oXyW8WQwL._SX258_BO1,204,203,200_.jpg
    "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague." – Edsger W. Dijkstra

  6. #6
    Sencha User
    Join Date
    Jun 2015
    Posts
    7

    Default

    Quote Originally Posted by yeghikyan View Post
    In the method 'doOpenRecordForm' you have
    Code:
    var tabId = form + '-plainRecord-' + oid.replace(/[_|]/g, '-');
    it generates the same id for all the tabs. If you will change it so, that jeden tab will get unique id, it will not crash.
    Code:
    var tabId = form + '-plainRecord-' + oid.replace(/[_|]/g, '-') + Ext.id();
    P.S.
    it is better to avoid using of 'id' property and use 'itemId'.

    P.P.S.
    51oXyW8WQwL._SX258_BO1,204,203,200_.jpg
    Yes, you're right it but this solution is not which I'm looking for, neither the best, because for every tab we open, it will consume memory even if it was closed.

    I'm updating first post with more details of my malfunction.

    However, thanks for see the app, see de code and reply!

    Pd: I did'nt wrote this app. It was wrote on EXTJS2, migrated to 3, then 4 and now to 5. Once fixed all errors i'll rebuild all code with the news good practices. (and optimization, reducction and cleaning of code). Think also this is a dirty copy of the core of the app to show how is my bug.

Similar Threads

  1. Replies: 0
    Last Post: 18 Mar 2011, 6:40 AM
  2. Problem when closing tabpanel
    By tBSTAR in forum Ext 3.x: Help & Discussion
    Replies: 6
    Last Post: 14 Jan 2011, 7:16 AM
  3. [2.0.1][CLOSED] TabPanel closing
    By Green in forum Ext 2.x: Bugs
    Replies: 4
    Last Post: 15 Feb 2009, 3:00 AM
  4. Error on closing tab destroying app
    By ojintoad in forum Ext 1.x: Help & Discussion
    Replies: 7
    Last Post: 6 Feb 2007, 12:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •