Example #1
0
 initialize: function(models,options){
     Backgrid.requireOptions(options, ['metafields']);
     this.sortable = options.sortable;
     this.editable = !!options.editable;
     this.selectedId = options.selectedId;
     this.metafields = options.metafields;
     this.preColumns = options.preColumns || [];
     this.cell = options.cell;
     this.listenTo(this.metafields, {
         'add': this.onMetafieldAdd,
         'remove': this.onMetafieldRemove,
         'reset': this.onMetafieldReset,
         'change': this.onMetafieldChange
     });
     this.onMetafieldReset(this.metafields);
 },
Example #2
0
        initialize: function (options) {
            Backgrid.requireOptions(options, ["collection"]);

            if (options && options.windowSize) {
                this.windowSize = options.windowSize;
            }

            var collection = this.collection;
            var fullCollection = collection.fullCollection;
            if (fullCollection) {
                this.listenTo(fullCollection, "add", this.render);
                this.listenTo(fullCollection, "remove", this.render);
                this.listenTo(fullCollection, "reset", this.render);
            }
            else {
                this.listenTo(collection, "add", this.render);
                this.listenTo(collection, "remove", this.render);
                this.listenTo(collection, "reset", this.render);
                this.listenTo(collection, "state", this.render);
            }
        },