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';

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

© 2023 Alfresco Software, Inc. All Rights Reserved.