diff --git a/ng2-components/ng2-alfresco-datatable/README.md b/ng2-components/ng2-alfresco-datatable/README.md index 660c448a8e..ef312cecd0 100644 --- a/ng2-components/ng2-alfresco-datatable/README.md +++ b/ng2-components/ng2-alfresco-datatable/README.md @@ -123,6 +123,7 @@ export class DataTableDemo { | fallbackThumbnail | string | | Fallback image for row ehre thubnail is missing| | contextMenu | boolean | false | Toggles custom context menu for the component | | allowDropFiles | boolean | false | Toggle file drop support for rows (see **ng2-alfresco-core/UploadDirective** for more details) | +| loading | boolean | false | Flag that indicate if the datable is in loading state and need to show the loading template. Read the documentation above to know how to configure a loading template | ### DataColumn Properties @@ -176,7 +177,9 @@ onRowClick(event) { ![](docs/assets/datatable-dom-events.png) -### Advanced usage +### Empty content template + +You can add a template that will be showed when there are no result in your datatable: ```html - - - + + + + + +

Sorry, no content

+
+
+
``` +### Loading content template + +You can add a template that will be showed during the loading of your data: + +```html + + + + + + + + + + + +``` + +```js + isLoading(): boolean { + //your custom logic to identify if you are in a loading state + } +``` + +Note: the `` and `` can be used together + #### Column Templates It is possible assigning a custom column template like the following: diff --git a/ng2-components/ng2-alfresco-datatable/index.ts b/ng2-components/ng2-alfresco-datatable/index.ts index 9c599b0290..bba922f795 100644 --- a/ng2-components/ng2-alfresco-datatable/index.ts +++ b/ng2-components/ng2-alfresco-datatable/index.ts @@ -26,7 +26,8 @@ export * from './src/components/datatable/data-cell.event'; export * from './src/components/datatable/data-row-action.event'; import { DataTableComponent } from './src/components/datatable/datatable.component'; -import { NoContentTemplateComponent } from './src/components/datatable/no-content-template.component'; +import { NoContentTemplateComponent } from './src/directives/no-content-template.component'; +import { LoadingContentTemplateComponent } from './src/directives/loading-template.component'; import { PaginationComponent } from './src/components/pagination/pagination.component'; import { DataTableCellComponent } from './src/components/datatable/datatable-cell.component'; @@ -34,6 +35,7 @@ export const ALFRESCO_DATATABLE_DIRECTIVES: [any] = [ DataTableComponent, DataTableCellComponent, NoContentTemplateComponent, + LoadingContentTemplateComponent, PaginationComponent ]; diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.css b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.css index d7157b532c..5fe1ddaa6d 100644 --- a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.css +++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.css @@ -26,11 +26,20 @@ /* Empty folder */ -:host .no-content-container { +:host .adf-no-content-container { padding: 0 !important; } -:host .no-content-container > img { +:host .adf-no-content-container > img { + width: 100%; +} +/* Loading folder */ + +:host .adf-loading-content-container { + padding: 0 !important; +} + +:host .adf-loading-content-container > img { width: 100%; } diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html index 710ee9d1ae..528445ea4e 100644 --- a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html +++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html @@ -38,7 +38,8 @@ -