Results 1 to 5 of 5

Thread: tabpanel modifications(add, delete tabs) and submit his formpanel container

  1. #1
    Sencha Premium User
    Join Date
    Mar 2012
    Location
    germany
    Posts
    28

    Default tabpanel modifications(add, delete tabs) and submit his formpanel container

    Hello,

    May can someone help me.

    I have a tabpanel on a formpanel. After having loaded data, it can be possible to change (add or delete tabs on this tabpanel) it and submit it.
    on each tab i have a component with validator.
    You must also know that on each tab i call the same container, but it's ok 'cause i'm just working with itemIds.
    The problem is when i delete a tab and i want to submit the form, the validation of the component deleted is called, of course the code of validator generate errors 'cause the component is not here anymore.

  2. #2
    Sencha User
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165

    Default

    Sounds like you need to handle your form submit code in a beforedestroy event handler for each child item of your tabpanel.

  3. #3
    Sencha Premium User
    Join Date
    Mar 2012
    Location
    germany
    Posts
    28

    Default

    I don't really understand what you mean. Form.submit can't be in Beforedestroy event. I should first delete the tab , the form.submit must be done when the tab is destroyed. The problem is that when i destroy this tab, the component's validator which was in this tab is still called!!

    This is how i add the the tab:

    var schichtPanel = Ext.create('ZLNet.view.RegelArbeitszeitenContainer', {
    closable: true,
    AutoDestroy: true,
    id : 'RegelArbeitszeitenContainer_' + (new Date()).getMilliseconds(),
    listeners: {
    beforedestroy:function(cp) {
    cp.removeAll();
    }
    }
    });
    var tab = tabs.add(schichtPanel);
    tabs.setActiveTab(tab);
    tabs.doLayout();
    tabs.getActiveTab().down('numberfield').setValue(1);


    you can see the listener where i remove everything before the tab is destroyed.

    And there was in this tab a component with validator, and this validator is still called, that's the problem

  4. #4
    Sencha Premium User
    Join Date
    Mar 2012
    Location
    germany
    Posts
    28

    Default

    And this is the validator:

    var tabpanel = this.up('tabpanel');
    var numberfields = tabpanel.query('numberfield');

    var count = 0;
    var i;

    for (i=0;i<numberfields.length;i++){
    if (numberfields[i].getValue()==value){
    count++;
    }
    }
    if (count>1){
    return "Die Schichtnummer muss eindeutig sein";
    }

    return true;
    var numberfields = tabpanel.query('numberfield');
    var count = 0;
    var i;
    for (i=0;i<numberfields.length;i++){
    if (numberfields[i].getValue()==value){
    count++;
    }
    }
    if (count>1){
    return "Die Schichtnummer muss eindeutig sein";
    }
    return true;


    the lines in red are causing the exception : "tabpanel is undefined".
    The scope of the "this" seems to still pointing on the component destroyed too.

  5. #5
    Sencha User
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165

    Default

    What if you do removeAll(true)

Posting Permissions

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