Browse Source

Add removeChildren to ItemsView in Layers

multiple-select
Artur Arseniev 8 years ago
parent
commit
606e2d7195
  1. 1
      src/navigator/view/ItemView.js
  2. 6
      src/navigator/view/ItemsView.js

1
src/navigator/view/ItemView.js

@ -67,7 +67,6 @@ module.exports = require('backbone').View.extend({
const components = model.get('components');
model.set('open', false);
this.listenTo(components, 'remove add change reset', this.checkChildren);
this.listenTo(model, 'destroy remove', this.remove);
this.listenTo(model, 'change:status', this.updateStatus);
this.listenTo(model, 'change:open', this.updateOpening);
this.listenTo(model, 'change:style:display', this.updateVisibility);

6
src/navigator/view/ItemsView.js

@ -16,6 +16,7 @@ module.exports = require('backbone').View.extend({
const coll = this.collection;
this.listenTo(coll, 'add', this.addTo);
this.listenTo(coll, 'reset resetNavigator', this.render);
this.listenTo(coll, 'remove', this.removeChildren);
this.className = `${pfx}layers`;
const em = config.em;
@ -44,6 +45,11 @@ module.exports = require('backbone').View.extend({
parent && this.$el.data('model', parent);
},
removeChildren(removed) {
const view = removed.viewLayer;
view.remove.apply(view);
},
/**
* Add to collection
* @param Object Model

Loading…
Cancel
Save