2014-05-01 53 views
0
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); 

回答

0

固定的,只是錯在我的部分,哎呦:)

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); 
     }