0

Marionette.Js の問題でクリア div を追加できない

私が行うすべてのことは、アイテムの前にdiv clearを追加することでした

お気に入り

リストクリアアイテムアイテムアイテム

ここに私のコードがあります

var MyItemView = Backbone.Marionette.ItemView.extend({
        template: tplI ,
        className: 'item', 
        tagName : 'article', 
    });
var myCompositeView = Backbone.Marionette.CompositeView.extend({
        itemView: MyItemView , 
        itemViewContainer: "#list",
        template: tplC ,
        className : 'wikis' ,

        initialize: function () { 
            this.collection = new Collection () ;  
            this.model = new CollectionModel() ;
            this.listenTo(this.collection, "reset", this.set);
        },
        set: function ( collect ) {
            this.model.set( collect.wiki ) ; 
            this.render() ;  
        } ,
        onRender : function( evt ){
            if ( $.trim( this.$('#list').html() ) != "" ) {  
                this.$('#list').append( '<div class="clear"></div>' ) ; 
            }
        },
        onClose :function() { $('#list').
            this.$el.height( 0 ) ; 
        }
    }); 

ご協力いただきありがとうございます

4

1 に答える 1

0

一時的な修正を見つける

オンライン 1566

// Internal method to loop through each item in the
  // collection view and show it
  showCollection: function(){
    var ItemView;
    this.collection.each(function(item, index){
      ItemView = this.getItemView(item);
      this.addItemView(item, ItemView, index);
    }, this);
    this.triggerMethod("renderCollection", this);
  },

その後

コレクション ビューで

initialize: function () { 
        //console.log( 'collectionView' ) ; 
        this.on( 'renderCollection' , this.collectionrendered ) ;
    }, 
collectionrendered: function(){
        this.$el.find( this. itemViewContainer ).append( '<div class="clear"></div>' ) ;
        console.log('collectionrendered') ;
    }
于 2013-09-16T04:50:58.810 に答える