1. #1
    Sencha User
    Join Date
    Jun 2011
    Location
    Iasi, Romania
    Posts
    144
    Vote Rating
    0
    catalin.ciobanu is on a distinguished road

      0  

    Default TabPanel adding new tab from child tab

    TabPanel adding new tab from child tab


    Hello, I am glad to be here (this is my first post). I hope I can find help here, and I also hope I will be able to help others.

    I am trying to develop an application which requires working with TabPanel component.
    In a tab I have a Grid which keeps some records (each record is a Tabel object defined by me). I want to be able to do the following:

    When I double-click on a record I want a new tab-item to appear in the tabpanel, tab-item which contains the records contained in the table which have just been double-clicked on.

    I have the following:
    Code:
    grid.addListener(Events.RowDoubleClick,
                    new Listener<GridEvent<BeanModel>>() {
                        @Override
                        public void handleEvent(GridEvent<BeanModel> be) {
                            String tableName = be.getModel().get("tableName");
                            TableDetailsGrid tdg = new TableDetailsGrid();
                            //Here I want to add somehow the new object "TableDetailsGrid" to the big TabPanel
                        }
                    });
    I thought I need somehow to get the parent by getParent(), I manage to get to the TabPanel and .. let's say .. get it's ID, but I just don't know how to add a new TabItem.

    Any suggestion would be very valuable. Thanks!

  2. #2
    Sencha User
    Join Date
    Mar 2011
    Posts
    79
    Vote Rating
    0
    vtysh is on a distinguished road

      0  

    Default


    Can't you keep necessary TabPanel in some variable?
    http://www.sencha.com/examples/#advancedtabs

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Location
    Iasi, Romania
    Posts
    144
    Vote Rating
    0
    catalin.ciobanu is on a distinguished road

      0  

    Default


    My problem is that for each TabItem I have a class and I put them all together in the EntryPoint. I don't know could I keep the TabPanel (which is defined in the entrypoint class) and to make it available for all the classes

    ps: thanks for the quick answer.

  4. #4
    Sencha User
    Join Date
    Jun 2011
    Location
    Iasi, Romania
    Posts
    144
    Vote Rating
    0
    catalin.ciobanu is on a distinguished road

      0  

    Default


    Figured it out. It looks like this:
    Code:
    grid.addListener(Events.RowDoubleClick,
                    new Listener<GridEvent<BeanModel>>() {
    
                        @Override
                        public void handleEvent(GridEvent<BeanModel> be) {
    
                            String tableName = be.getModel().get("tableName");
                            TableDetailsGrid tdg = new TableDetailsGrid();
                            TabItem ti = new TabItem(tableName);
                            ti.add(tdg);
                            ti.setClosable(true);
                            ((TabPanel) grid.getParent().getParent().getParent()
                                    .getParent()).add(ti);
                            ((TabPanel) grid.getParent().getParent().getParent()
                                    .getParent()).setSelection(ti);
    
                        }
                    });
    Hope it will help someone in the future

  5. #5
    Sencha User
    Join Date
    Oct 2010
    Posts
    5
    Vote Rating
    0
    Lbgxter is on a distinguished road

      0  

    Default


    You can use the com.extjs.gxt.ui.client.Registry class.

    Example.
    In your entry point,
    Code:
    YourTabPanel tabPanel = new YourTabPanel();
    Registry.register("tabPanel", tabPanel);
    .
    .
    .
    And in your another GUI classes,
    Code:
    YourTabPanel tabPanel = Registry.get("tabPanel");
    .
    .
    .

  6. #6
    Sencha User
    Join Date
    Jun 2011
    Location
    Iasi, Romania
    Posts
    144
    Vote Rating
    0
    catalin.ciobanu is on a distinguished road

      0  

    Default


    Thanks a lot, actually that Registry approach will help me a lot with the nest task

    Thank you guys.

  7. #7
    Sencha User
    Join Date
    Nov 2012
    Posts
    4
    Vote Rating
    0
    mkarthik415 is on a distinguished road

      0  

    Default Thank you.

    Thank you.


    worked like charm !!

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."