comindware.core.ui
Version:
Comindware Core UI provides the basic components like editors, lists, dropdowns, popups that we so desperately need while creating Marionette-based single-page applications.
33 lines (26 loc) • 797 B
JavaScript
/*eslint-disable*/
import { helpers, comparators } from 'utils';
import VirtualCollection from '../../../../../collections/VirtualCollection';
import MemberModel from '../models/MemberModel';
export default VirtualCollection.extend({
model: MemberModel,
comparator: helpers.comparatorFor(comparators.stringComparator2Asc, 'name'),
applyTextFilter(text) {
this.deselect();
this.unhighlight();
if (!text) {
this.filter(null);
this.selectFirst();
return;
}
text = text.toLowerCase();
this.filter(model => model.matchText(text));
this.highlight(text);
this.selectFirst();
},
selectFirst() {
if (this.length > 0) {
this.at(0).select();
}
}
});