Title | Added | Status | Last reviewed |
---|---|---|---|
Row Filter Model |
v2.0.0 |
Active |
2019-02-08 |
Defines the Row Filter function used by the Document List Component.
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
- value:
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;
};
}
}