1. #1
    Sencha User poojagarg89's Avatar
    Join Date
    Sep 2011
    Location
    Ahmedabad,India
    Posts
    213
    Vote Rating
    0
    poojagarg89 is on a distinguished road

      0  

    Default Can a single FormPanel be used in two or more TabPanels at a time

    Can a single FormPanel be used in two or more TabPanels at a time


    Hi,

    I wanna do something like one FormPanel and two Tabs using that same Panel...............Can it be done???



    ex:
    Code:
           var form = new Ext.form.FormPanel({
                 items:[{
                       xtype:"combo",
                       id:"id_1"
                 },{
                       xtype:"combo",
                       id:"id_2"
                 },{
                      xtype:"button",
                      text:"save",
                      handler: function(){
                             if(tab1){
                                     alert("Save TAB_1 values");
                             }else{
                                     alert("Save TAB_2 values");
                             }
                      }
                 }]
           });
    
          var tabpanel = new NoSwitchTabPanel({
                 items:[{
                        id:'tab_1',
                        title: 'TAB_1',
                        layout:'fit',
                        region:'center',
                        hideMode:'offsets',
                        items:[form]                                // Using same FormPanel in tab_1
                 },{
                        id:'tab_2',
                        title: 'TAB_2',
                        layout:'fit',
                        region:'center',
                        hideMode:'offsets',
                        items:[form]                                // Using same FormPanel in tab_2
                 }]
          });

    as I applied this code it gave me like "form" was not seen in TAB_1 but was visible in TAB_2 or should be said it rendered in the 2nd Tab but not in Tab 1

    Or
    Is there another way to do the same n the FormPanel is not a popup it is placed on the center region of border Layout

    Thanks n Regards,
    Pooja

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    549
    Vote Rating
    54
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Just add multiple instances of the same form - but you will have to remove all IDs from any components/elements for this to work without causing errors.

  3. #3
    Sencha User poojagarg89's Avatar
    Join Date
    Sep 2011
    Location
    Ahmedabad,India
    Posts
    213
    Vote Rating
    0
    poojagarg89 is on a distinguished road

      0  

    Default


    multiple instances like????
    I mean what I need to do for making multiple instances of this form can u give small example ??

  4. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    549
    Vote Rating
    54
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Here's an example of adding multiple instances of the same form to a tabpanel:
    http://jsfiddle.net/Whinters/jzT3p/

  5. #5
    Sencha User poojagarg89's Avatar
    Join Date
    Sep 2011
    Location
    Ahmedabad,India
    Posts
    213
    Vote Rating
    0
    poojagarg89 is on a distinguished road

      0  

    Default


    Thanks willigogs
    well this code is in ExtJs 4.1 and MVC model is applied to this
    I'll try converting /using same code in ExtJs 3.4 as my full app. is in extjs3.4


  6. #6
    Sencha User
    Join Date
    Jan 2011
    Posts
    549
    Vote Rating
    54
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    This is EXTJS 3.4 code

    (Notice the scripts being called in the top left panel)

  7. #7
    Sencha User poojagarg89's Avatar
    Join Date
    Sep 2011
    Location
    Ahmedabad,India
    Posts
    213
    Vote Rating
    0
    poojagarg89 is on a distinguished road

      0  

    Default


    oopz sorry.....................will use same code

Thread Participants: 1