diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.html b/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.html
index 6bee3e7145..7554a3e7e0 100644
--- a/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.html
+++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.html
@@ -41,15 +41,19 @@
-
+ (click)="onRowClick(row, $event)"
+ (dblclick)="onRowDblClick(row, $event)">
+
{{asIconValue(row, col)}}
-
+
{{data.getValue(row, col)}}
-
+
+ {{data.getValue(row, col)}}
+
+
diff --git a/ng2-components/ng2-alfresco-datatable/src/data/datatable-adapter.ts b/ng2-components/ng2-alfresco-datatable/src/data/datatable-adapter.ts
index cec755921f..9ba0a0c716 100644
--- a/ng2-components/ng2-alfresco-datatable/src/data/datatable-adapter.ts
+++ b/ng2-components/ng2-alfresco-datatable/src/data/datatable-adapter.ts
@@ -25,7 +25,7 @@ export interface DataTableAdapter {
getSorting(): DataSorting;
setSorting(sorting: DataSorting): void;
sort(key?: string, direction?: string): void;
-
+
}
export interface DataRow {
@@ -39,7 +39,8 @@ export interface DataRow {
export interface DataColumn {
key: string;
- type: string; // text|image
+ type: string; // text|image|date
+ format?: string;
sortable?: boolean;
title?: string;
srTitle?: string;
diff --git a/ng2-components/ng2-alfresco-datatable/src/data/object-datatable-adapter.ts b/ng2-components/ng2-alfresco-datatable/src/data/object-datatable-adapter.ts
index 16cf6ad0f7..b5677e0b71 100644
--- a/ng2-components/ng2-alfresco-datatable/src/data/object-datatable-adapter.ts
+++ b/ng2-components/ng2-alfresco-datatable/src/data/object-datatable-adapter.ts
@@ -15,6 +15,8 @@
* limitations under the License.
*/
+import { DatePipe } from '@angular/common';
+
import {
DataTableAdapter,
DataRow,
@@ -78,7 +80,20 @@ export class ObjectDataTableAdapter implements DataTableAdapter {
if (!col) {
throw new Error('Column not found');
}
- return row.getValue(col.key);
+
+ let value = row.getValue(col.key);
+
+ if (col.type === 'date') {
+ let datePipe = new DatePipe();
+ let format = col.format || 'medium';
+ try {
+ return datePipe.transform(value, format);
+ } catch (err) {
+ console.error(`DocumentList: error parsing date ${value} to format ${format}`);
+ }
+ }
+
+ return value;
}
getSorting(): DataSorting {
|