Vue Attract: Sort/filterable table based on Vue
Initial commit implementing sortable and filterable tables for attract using Vue.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import {AttractRowBase} from '../../attracttable/rows/AttractRowBase'
|
||||
import { TaskEventListener } from '../../attracttable/rows/TaskEventListener';
|
||||
|
||||
class ShotRow extends AttractRowBase {
|
||||
constructor(shot) {
|
||||
super(shot);
|
||||
this.tasks = [];
|
||||
}
|
||||
|
||||
thenInit() {
|
||||
return attract.api.thenGetTasks(this.getId())
|
||||
.then((response) => {
|
||||
this.tasks = response._items;
|
||||
this.registerTaskEventListeners();
|
||||
this.isInitialized = true;
|
||||
})
|
||||
}
|
||||
|
||||
registerTaskEventListeners() {
|
||||
new TaskEventListener(this).register();
|
||||
}
|
||||
|
||||
getTasksOfType(taskType) {
|
||||
return this.tasks.filter((t) => {
|
||||
return t.properties.task_type === taskType;
|
||||
})
|
||||
}
|
||||
|
||||
getRowClasses() {
|
||||
let classes = super.getRowClasses()
|
||||
if(this.isInitialized) {
|
||||
classes['shot-not-in-edit'] = !this.underlyingObject.properties.used_in_edit;
|
||||
}
|
||||
return classes;
|
||||
}
|
||||
}
|
||||
|
||||
export { ShotRow }
|
Reference in New Issue
Block a user