1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    3
    Answers
    1
    Vote Rating
    0
    fabergé is on a distinguished road

      0  

    Default Answered: ExtJs dynamically load store in menu

    Answered: ExtJs dynamically load store in menu


    Hi,

    I'm trying to do the following,
    I've got a store with 'favorite' records and i like them to display in a menu structure dynamically. I get the following error if i run it with the following code: Unable to get value of the property 'add': object is null or undefined. Is there any other way to do this?

    Store load:
    Code:
    var lFilterStore = Ext.create('WorkB.store.general.filter.Filters');
    lFilterStore.load({
          callback: function (records) {
             var lPersonsFavMenu = me.down('menuitem[name=favoritePersonMenu]');
             Ext.each(records, function (record) {
                      lPersonsFavMenu.item.add({ text: record.get('Name') });
             });
          }
    });

    Menu structure:
    Code:
    xtype: 'menu',
    showSeparator: false,
    floating: false,
    border: 0,
    margin: '0 0 5 0',
    items: [{
           text: 'Favorieten',
           menu: [{
                text: 'Person',
                name: 'favoritePersonMenu'
           }, {
                text: 'Customer',
                name: 'favoriteCustomerMenu'
          }]
    }]

  2. Change .items.add with .menu.add

    Code:
    var lFilterStore = Ext.create('WorkB.store.general.filter.Filters');
    lFilterStore.load({      
          callback: function (records) {         
                        var lPersonsFavMenu = me.down('menuitem[name=favoritePersonMenu]');  
                        Ext.each(records, function (record) {
                                lPersonsFavMenu.menu.add({ text: record.get('Name') });
                        });
          }
    });

  3. #2
    Sencha User
    Join Date
    Mar 2011
    Posts
    114
    Answers
    3
    Vote Rating
    6
    johanhaest is on a distinguished road

      0  

    Default


    Change .items.add with .menu.add

    Code:
    var lFilterStore = Ext.create('WorkB.store.general.filter.Filters');
    lFilterStore.load({      
          callback: function (records) {         
                        var lPersonsFavMenu = me.down('menuitem[name=favoritePersonMenu]');  
                        Ext.each(records, function (record) {
                                lPersonsFavMenu.menu.add({ text: record.get('Name') });
                        });
          }
    });

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