mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
test and doc generateSchema
This commit is contained in:
@@ -32,22 +32,26 @@ export class ObjectDataTableAdapter implements DataTableAdapter {
|
||||
private _rows: DataRow[];
|
||||
private _columns: DataColumn[];
|
||||
|
||||
static generateSchema(rowToExaminate: any) {
|
||||
static generateSchema(data: any[]) {
|
||||
let schema = [];
|
||||
|
||||
if (typeof rowToExaminate === 'object') {
|
||||
for (let key in rowToExaminate) {
|
||||
if (rowToExaminate.hasOwnProperty(key)) {
|
||||
schema.push({
|
||||
type: 'text',
|
||||
key: key,
|
||||
title: key,
|
||||
sortable: false
|
||||
});
|
||||
if (data && data.length) {
|
||||
let rowToExaminate = data[0];
|
||||
|
||||
if (typeof rowToExaminate === 'object') {
|
||||
for (let key in rowToExaminate) {
|
||||
if (rowToExaminate.hasOwnProperty(key)) {
|
||||
schema.push({
|
||||
type: 'text',
|
||||
key: key,
|
||||
title: key,
|
||||
sortable: false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user