Andy Stark 1079361c2c [ADF-3745] Updates for doc review (#4291)
* [ADF-3745] Updates for doc review

* [ADF-3745] Fixed bad links to Content node selector page

* [ADF-3745] Updated index files
2019-02-08 21:21:06 +00:00

2.6 KiB

Title, Added, Status, Last reviewed
Title Added Status Last reviewed
Row Filter Model v2.0.0 Active 2019-02-08

Row Filter Model

Defines the Row Filter function used by the Document List Component.

Definitions

  • type RowFilter = (value: ShareDataRow, index: number, array: ShareDataRow[]) => any
    • value: ShareDataRow - Data that defines the row
    • index: number - Index of the row within the list
    • array: ShareDataRow[] - The full set of rows for the list
    • Returns True if the row should be shown, false otherwise

Details

A row filter function selectively hides or shows rows from a Document List Component or another component that uses the Document List (such as the Content Node Selector Panel Component). You can supply your own row filter to customize the behavior of the list.

The function returns true if the row should be displayed or false if it should be hidden. A typical row filter implementation receives at least a ShareDataRow object as a parameter:

myFilter(row: ShareDataRow): boolean {
    return true;
}

Note that for the sake of simplicity the example code below was reduced to the main points of interest only.

View1.component.html

<adf-document-list 
    [rowFilter]="folderFilter">
</adf-document-list>

View1.component.ts

import { RowFilter, ShareDataRow } from '@alfresco/adf-content-services';

export class View1 {

    folderFilter: RowFilter;

    constructor() {
    
        // This filter will make the document list show only folders
        
        this.folderFilter = (row: ShareDataRow) => {
            let node = row.node.entry;
            
            if (node && node.isFolder) {
                return true;
            }
            
            return false;
        };
    }
}

See also