Add first task selection on filter change

This commit is contained in:
mauriziovitale84
2016-09-08 13:31:44 +01:00
parent 24b651a25a
commit dc0ea9d828
4 changed files with 54 additions and 2 deletions

View File

@@ -95,6 +95,7 @@ export class ActivitiTaskList implements OnInit {
this.activiti.getTasks(filterParam).subscribe(
(response) => {
this.renderTasks(response.data);
this.selectFirstTask();
this.onSuccess.emit(response);
}, (error) => {
console.error(error);
@@ -115,6 +116,25 @@ export class ActivitiTaskList implements OnInit {
this.tasks = new ObjectDataTableAdapter(tasks, this.data.getColumns());
}
/**
* Select the first task of a tasklist if present
*/
private selectFirstTask() {
if (!this.isTaskListEmpty()) {
this.currentTaskId = this.tasks.getRows()[0].getValue('id');
} else {
this.currentTaskId = null;
}
}
/**
* Return the current task
* @returns {string}
*/
getCurrentTaskId(): string {
return this.currentTaskId;
}
/**
* Check if the tasks list is empty
* @returns {ObjectDataTableAdapter|boolean}