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,30 @@
|
||||
let ColumnBase = pillar.vuecomponents.table.columns.ColumnBase;
|
||||
import {ParentNameCell} from '../cells/ParentName'
|
||||
|
||||
class ParentName extends ColumnBase {
|
||||
constructor() {
|
||||
super('Parent', 'parent-name');
|
||||
}
|
||||
|
||||
getCellRenderer(rowObject) {
|
||||
return ParentNameCell.options.name;
|
||||
}
|
||||
|
||||
getRawCellValue(rowObject) {
|
||||
if(!rowObject.getParent()) return '';
|
||||
return rowObject.getParent().name || '<No Name>';
|
||||
}
|
||||
|
||||
compareRows(rowObject1, rowObject2) {
|
||||
let parent1 = rowObject1.getParent();
|
||||
let parent2 = rowObject2.getParent();
|
||||
if (parent1 && parent2) {
|
||||
if (parent1.name === parent2.name) {
|
||||
return parent1._id < parent2._id ? -1 : 1;
|
||||
}
|
||||
}
|
||||
return super.compareRows(rowObject1, rowObject2);
|
||||
}
|
||||
}
|
||||
|
||||
export { ParentName }
|
@@ -0,0 +1,13 @@
|
||||
let ColumnBase = pillar.vuecomponents.table.columns.ColumnBase;
|
||||
|
||||
class ShortCode extends ColumnBase {
|
||||
constructor() {
|
||||
super('Short Code', 'short-code');
|
||||
}
|
||||
|
||||
getRawCellValue(rowObject) {
|
||||
return rowObject.getTask().properties.shortcode || '';
|
||||
}
|
||||
}
|
||||
|
||||
export { ShortCode }
|
@@ -0,0 +1,13 @@
|
||||
let ColumnBase = pillar.vuecomponents.table.columns.ColumnBase;
|
||||
|
||||
class TaskType extends ColumnBase {
|
||||
constructor() {
|
||||
super('Type', 'task-type');
|
||||
}
|
||||
|
||||
getRawCellValue(rowObject) {
|
||||
return rowObject.getTask().properties.task_type || '';
|
||||
}
|
||||
}
|
||||
|
||||
export { TaskType }
|
@@ -0,0 +1,27 @@
|
||||
import { Status } from '../../attracttable/columns/Status'
|
||||
import { RowObject } from '../../attracttable/columns/RowObject'
|
||||
import { TaskDueDate } from '../../attracttable/columns/TaskDueDate'
|
||||
import { TaskType } from './TaskType'
|
||||
import { ShortCode } from './ShortCode'
|
||||
import { ParentName } from './ParentName'
|
||||
|
||||
let ColumnFactoryBase = pillar.vuecomponents.table.columns.ColumnFactoryBase;
|
||||
|
||||
|
||||
class TasksColumnFactory extends ColumnFactoryBase{
|
||||
thenGetColumns() {
|
||||
return this.thenGetProject()
|
||||
.then((project) => {
|
||||
return [
|
||||
new Status(),
|
||||
new ParentName(),
|
||||
new RowObject(),
|
||||
new ShortCode(),
|
||||
new TaskType(),
|
||||
new TaskDueDate(),
|
||||
];
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export { TasksColumnFactory }
|
Reference in New Issue
Block a user