Browse Source

Add `index` method to Component API

pull/1656/head
Artur Arseniev 8 years ago
parent
commit
1db1415548
  1. 9
      src/dom_components/model/Component.js

9
src/dom_components/model/Component.js

@ -188,6 +188,15 @@ const Component = Backbone.Model.extend(Styleable).extend(
return !!(this.get('type') == type);
},
/**
* Get the index of the component in the parent collection.
* @return {Number}
*/
index() {
const { collection } = this;
return collection && collection.indexOf(this);
},
/**
* Find inner components by query string.
* **ATTENTION**: this method works only with already rendered component

Loading…
Cancel
Save