[CLOSED] TabPanel1 .RemoveAll throwing a javascript error

  1. #1

    [CLOSED] TabPanel1 .RemoveAll throwing a javascript error

    Hello,

    I have a tabpanel that has several panels. on each request I want to remove all panels in this TabPanel and add different panels.
    I tried TabPanel1.RemoveAll(); from codebehind it throw a javascript error "Cannot read property 'removeAttribute' of null" even when I tried to do it in Javascript (App.TabPanel1.removeAll();) throw the same error.
    It works 3 to 4 times and then it throw this error in console.


    Note: I am creating the panels and adding them to the TabPanel1 in javascript


    for (var i = 0; i < tabs.length; i++) {
                            var pid = "panel" + i;
                            var panel = Ext.create('Ext.panel.Panel', {
                                title: tabs[i],
                                id: pid,
                                flex: 1,
                                layout: 'fit',
    
                            });
    
                            App.TabPanel1.add(panel);
    }

    Please any advice?


    Thank you
    Last edited by fabricio.murta; Apr 27, 2018 at 2:40 PM.
  2. #2
    Hello @geovision!

    At first it may look right to call removeAll() to remove all tabs from a Tab Panel. But that would just remove the tab contents, without cleanly erasing the tabs' information from the tab panel's "Tab Bar" subcomponent.

    In fact, the removeAll() is a generic, component-level method to remove any components that may be enclosed by any container (which a tab panel is, by inheritance).

    I couldn't find a specific way to clean up all tabs from a tab panel in one shot, but if you want to remove all tabs, you can just keep checking if there is any active tab and, until it doesn't, close the tab.

    In other words (I used Tab Panel > Advanced Tabs example as base as you didn't provide any sample code), you can just:

    while (at = App.TabPanel1.getActiveTab()) { at.close() }
    And it should gracefully close all tabs. Ensure that all added tabs (panels) have closeAction as destroy, else they will be just hid and their handles will still occupy resources in your web page.

    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello again, @Geovision!

    It's been a while since we last replied your inquiry here and still no feedback from you. Do you still need help here? We may mark the thread as closed if you do not post a follow-up in 7+ days from now, but we won't lock up the thread, so you'll still be able to post afterwards.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Jun 15, 2018, 7:57 PM
  2. [CLOSED] Infinite Scrolling throwing Parser Error
    By rnachman in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 03, 2012, 5:19 PM
  3. [CLOSED] Tab Strip throwing error while adding at toolbar
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 13, 2011, 5:23 PM
  4. [CLOSED] Popup throwing error while closing.
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 01, 2011, 9:36 AM
  5. Replies: 3
    Last Post: Mar 30, 2010, 3:03 AM

Posting Permissions