1. #1
    Sencha User
    Join Date
    Feb 2008
    Posts
    23
    Vote Rating
    1
    Buzzwords is on a distinguished road

      0  

    Default TabScrollerMenu tweaks

    TabScrollerMenu tweaks


    A couple of small things popped up on this nice little plugin. First, when the tabpanel has fewer tabs than the value specified for menu pageSize, no menu is built at all. The plugin code tries to avoid adding the active tab AND any hidden tabpanel children to the menu. I think the assumption was that all tabs would be visible in this case. But if the tabpanel is in a window or another pane whose width is such that some tabs are hidden, it would be helpful to have all tabs in the dropdown menu. To change the default behavior I changed function generateTabMenuItems (around line ~200) from this:
    Code:
            else {
                tabPanel.items.each(function(item) {
                	if (item.id != curActive.id && !item.hidden) {
                        me.tabsMenu.add(me.autoGenMenuItem(item));
                    }
                });
            }
    to this:
    Code:
            else {
                tabPanel.items.each(function(item) {
                	me.tabsMenu.add(me.autoGenMenuItem(item));
                });
            }
    In addition, I found an edge case bug. It is unlikely to be seen by most, but I'm including this description just in case. I was working with some mock data that had an 'id' field in each row, and the values of 'id' were integers starting with one (1). I used this data to build a set of tabs, assigning each tab the id of the record's 'id'. Doing this caused the first value in the tabscrollermenu to be duplicated. The reason is that the use of tabPanel.items.get sees a record having an id value of '1', which is actually the first record and was already added to the tree under index 0. This behavior is avoided by directly referencing the items.items array within the tabpanel. This change is at line 168.
    Code:
    for (x = 0; x < pageSize; x++) {
       index = x + curPage - pageSize;
    
       //item = tabPanel.items.get(index);
       item = tabPanel.items.items[index];  
                        
       menuItems.push(me.autoGenMenuItem(item));
    }
    Last edited by Buzzwords; 25 Nov 2011 at 10:34 AM. Reason: clarified that tabs were built from store data

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Nice job!
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread

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..." hd porno faketaxi