mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Add first task selection on filter change
This commit is contained in:
@@ -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}
|
||||
|
Reference in New Issue
Block a user