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

      0  

    Default Unanswered: ExtJs dynamically load store in menu

    Unanswered: 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. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,094
    Answers
    112
    Vote Rating
    96
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    change this:

    Code:
    lPersonsFavMenu.item.add({ text: record.get('Name') });
    to this:

    Code:
    lPersonsFavMenu.add({ text: record.get('Name') });

Thread Participants: 1

Tags for this Thread