Search code examples
javascriptenyo

Enyo JS : Set moon.DataGridList collection dynamically


Is there away to set a grid collection dynamically after an ajax call ? 

.....
        create: function () {
            this.inherited(arguments); 
            this.onFetchItemList();
        },  
        onFetchItemList: function(){
            var prof = this.userProfile;
             obj.getBrowse(prof,function onBrowseCallback(list){
                 this.set("collection", new enyo.Collection(list));
            });
        }
.....

I get this method is undefined when I try to use the set function  
this.$.gridList.set("collection" ,new enyo.Collection(list));

same error here as well :
this.$.gridList.collection.set('collection',this.shows);

Solution

  • Fixed, simply mistake on my part , whoops :)

     onFetchItemList: function(inSender, inEvent){
                var prof = this.userProfile;      
                var _gridList = this.$.gridList;
                var shows = new enyo.Collection();
                 obj.getBrowse(prof,function onBrowseCallback(list){
                    ameba_lastListViewed = [];
                    ameba_lastListViewed = list;
                    shows = new enyo.Collection(list); 
                      _gridList.set('collection',shows);
            }