siva kumar d4f57b8786 [ADF-3039] Task List - Enanchement (#3404)
* * Created DataColumnSchemaAssembler component to get column schema from html and app.config.json
* Removed column related  method  from tasklist.

* * Removed data property from the tasklist component
* Using rows input property instead of data input property of the datatable

* *  Renamed  DataColumnSchemaAssembler to DataTableSchema
* Refactored DataTableSchema component

* * Changed schem property into an  input schemaColumns property  in dataTable component

* * Added selectFirstRow input property to select a first row of datatable
* Removed unnecessary method from tasklist component

* * Added test case for the recent changes
* Added mock object for the tasklist spec

* * Added testcases for recent changes in the datatable component

* * Updated datatable and tasklist document for the recent changes

* * Refactored process-service and task list component
* Updated datatable document.

* [ADF-3039] Task List - Enanchement
* Changed schemaColumn name to columns
* Updated datatable documentation.
*  data input Annotated  with @deprecated in the tasklist component

* * Added an sorting input to the datatable.
* Updated datatable and tasklist documentation
* Added method to get current sorting order.

* * After rebasing

* * Revert  sorting changes

* * After rebase

* * fixed conflicts

* * Fixed failing testcase after rebased.
2018-06-01 09:39:09 +01:00

7.1 KiB

Added, Status, Last reviewed
Added Status Last reviewed
v2.0.0 Active 2018-04-16

Task List component

Renders a list containing all the tasks matched by the parameters specified.

Contents

Basic Usage

<adf-tasklist 
    [appId]="'1'" 
    [state]="'open'" 
    [assignment]="'assignee'">
</adf-tasklist>

Class members

Properties

Name Type Default value Description
appId number The id of the app.
assignment string The assignment of the process. Possible values are: "assignee" (the current user is the assignee), candidate (the current user is a task candidate", "group_x" (the task is assigned to a group where the current user is a member, no value(the current user is involved).
data DataTableAdapter Data source object that represents the number and the type of the columns that you want to show. Deprecated: in 2.4.0
landingTaskId string Define which task id should be selected after reloading. If the task id doesn't exist or nothing is passed then the first task will be selected.
multiselect boolean false Toggles multiple row selection, renders checkboxes at the beginning of each row
name string Name of the tasklist.
page number 0 The page number of the tasks to fetch.
presetColumn string Custom preset column schema in JSON format.
processDefinitionKey string Deprecated: 2.4.0
processInstanceId string The Instance Id of the process.
selectionMode string "single" Row selection mode. Can be none, single or multiple. For multiple mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows.
size number PaginationComponent.DEFAULT_PAGINATION.maxItems The number of tasks to fetch. Default value: 25.
sort string Define the sort order of the tasks. Possible values are : created-desc, created-asc, due-desc, due-asc
state string Current state of the process. Possible values are: completed, active.

Events

Name Type Description
error EventEmitter<any> Emitted when an error occurs.
rowClick EventEmitter<string> Emitted when a task in the list is clicked
rowsSelected EventEmitter<any[]> Emitted when rows are selected/unselected
success EventEmitter<any> Emitted when the task list is loaded

Details

This component displays lists of process instances both active and completed, using any defined process filter, and renders details of any chosen instance.

Setting the column schema

You can use an HTML-based schema declaration to set a column schema for the tasklist as shown below :

<adf-tasklist ...>
    <data-columns>
        <data-column key="name" title="NAME" class="full-width name-column"></data-column>
        <data-column key="created" title="Created" class="hidden"></data-column>
    </data-columns>
</adf-tasklist>

You can also set a static custom schema declaration in app.config.json as shown below:

"adf-task-list": {
        "presets": {
            "customSchema": [
            {
                    "key": "name",
                    "type": "text",
                    "title": "name",
                    "sortable": true         
            }],
            "default": [
                {
                    "key": "name",
                    "type": "text",
                    "title": "name",
                    "sortable": true
            }],
        }
}
<adf-tasklist 
    [appId]="'1'" 
    [presetColumn]="'customSchema'">
</adf-tasklist>

You can use an HTML-based schema and an app.config.json custom schema declaration at the same time:

"adf-task-list": {
        "presets": {
            "customSchema": [
            {
                    "key": "id",
                    "type": "text",
                    "title": "Id",
                    "sortable": true         
            }],
            "default": [
                {
                    "key": "name",
                    "type": "text",
                    "title": "name",
                    "sortable": true
            }],
        }
}
<adf-tasklist
    [appId]="'1'" 
    [presetColumn]="'customSchema'">
    <data-columns>
        <data-column key="assignee" title="Assignee" class="full-width name-column">
            <ng-template let-entry="$implicit">
                    <div>{{getFullName(entry.row.obj.assignee)}}</div>
            </ng-template>
        </data-column>
    </data-columns>
</adf-tasklist>

Setting Sorting Order for the list

you can pass sorting order as shown in the example below:

// Possible values are : `created-desc`, `created-asc`, `due-desc`, `due-asc`
let sortParam = 'created-desc'; 
<adf-tasklist
    [appId]="'1'"
    [sort]="sortParam">
</adf-tasklist>

Pagination strategy

The Tasklist also supports pagination as shown in the example below:

<adf-tasklist
    [appId]="'1'"
    [page]="page"
    [size]="size"
    #taskList>
</adf-tasklist>
<adf-pagination
    *ngIf="taskList"
    [target]="taskList"
    [supportedPageSizes]="supportedPages"
    #taskListPagination>
</adf-pagination>

DataTableAdapter example

See the DataTableAdapter page for full details of the interface and its standard implementation, ObjectDataTableAdapter. Below is an example of how you can set up the adapter for a typical tasklist.

[
 {"type": "text", "key": "id", "title": "Id"},
 {"type": "text", "key": "name", "title": "Name", "cssClass": "full-width name-column", "sortable": true},
 {"type": "text", "key": "formKey", "title": "Form Key", "sortable": true},
 {"type": "text", "key": "created", "title": "Created", "sortable": true}
]

DataColumn Features

You can customize the styling of a column and also add features like tooltips and automatic translation of column titles. See the DataColumn page for more information about these features.

Show custom template when tasklist is empty

You can add your own template or message as shown in the example below:

<adf-tasklist>
    <adf-empty-custom-content>
        Your Content
    </adf-empty-custom-content>
<adf-tasklist>

See also