Results 1 to 2 of 2

Thread: Removing old components, adding new ones and calling doLayout doesn't work?

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Germany
    Posts
    21

    Default Removing old components, adding new ones and calling doLayout doesn't work?

    Hi all =)

    I have encountered a problem with my app and would like to ask you for advice. Hope you can help me.

    Let me describe my app: I have set my app's layout to 'card'. The first view you see shows some categories you can click on. It has a mosaic design, like this:
    __ __ __ __
    |__| |__| |__| |__|
    __ __ __ __
    |__| |__| |__| |__|

    If one of the categories is tapped, the layoutmanager takes you to another view. That view's toolbar's title is set to the tapped cagetory's name. That works fine.
    Since each of the categories have sub-categories which contain the real products, I thought of using an accordion layout (using https://github.com/mitchellsimoens/E...ccordionLayout). Because each category has different subcategorys the accordion has to be rebuilt each time a category is clicked.
    Here's my function to rebuild the accordion:

    Code:
    rebuildPanelWithRecord: function (record) {                
        
        var topToolbar = Ext.getCmp('topToolbarID');
        topToolbar.setTitle(record.get('categoryName'));        
        
        Ext.getCmp('produktPanelAccordionID').removeAll(true);                
        Ext.getCmp('produktPanelAccordionID').add({xtype: 'panel', title: record.get('subCategoryOneName')});
        Ext.getCmp('produktPanelAccordionID').add({xtype: 'panel', title: record.get('subCategoryTwoName')});
        Ext.getCmp('produktPanelAccordionID').add({xtype: 'panel', title: record.get('subCategoryThreeName')});
        Ext.getCmp('produktPanelAccordionID').doLayout();                    
    }
    As you see I remove all items of the accordion panel and add the just tapped category's subcategory names. Finally I call accordion.doLayout().

    Here comes my problem: The first time I click on one of the categories, I see the correct subcategories listed in the accordionpanel. Then I return to the first view to select another category. Then on the view with the accordion panel I see the new subcategories but plus the subcategories of the category I clicked first. Looks like this:

    ____________________________
    |____________________________| }
    |____________________________| } -> the subcategories of the categorie I just clicked
    |____________________________| }
    |____________________________| }
    |____________________________| } -> the subcategories of the categorie I clicked before
    |____________________________| }

    In such a case I thought removeAll, add and doLayout is the right way to go. But my app is not of the same opinion.
    Could you please tell me what I am missing?
    Thanks in advance
    P.S.: I am a newbie to Sencha Touch, and still experimenting. So this app is for testing purposes =)

  2. #2
    Sencha User
    Join Date
    Aug 2011
    Location
    Germany
    Posts
    21

    Default

    Still couldn't get it work ... Any ideas, hints? Everything is welcome!

Tags for this Thread

Posting Permissions

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