Enyo JS:动态设置moon.DataGridList集合

时间:2014-05-01 16:18:56

标签: javascript enyo

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

1 个答案:

答案 0 :(得分: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);
        }