#9 binding custom columns to nested properties

allow binding columns to bested properties and property paths, i.e.
“item.location.path”
This commit is contained in:
Denys Vuika
2016-05-10 16:28:13 +01:00
parent 4cb441405c
commit caadc7ee9d
8 changed files with 96 additions and 2 deletions

View File

@@ -163,6 +163,32 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
}
return null;
};
/**
* Gets a value from an object by composed key
* documentList.getObjectValue({ item: { nodeType: 'cm:folder' }}, 'item.nodeType') ==> 'cm:folder'
* @param target
* @param key
* @returns {string}
*/
DocumentList.prototype.getObjectValue = function (target, key) {
var keys = key.split('.');
key = '';
do {
key += keys.shift();
var value = target[key];
if (value !== undefined && (typeof value === 'object' || !keys.length)) {
target = value;
key = '';
}
else if (!keys.length) {
target = undefined;
}
else {
key += '.';
}
} while (keys.length);
return target;
};
DocumentList.prototype.setupDefaultColumns = function () {
var thumbnailCol = new content_column_model_1.ContentColumnModel();
thumbnailCol.source = '$thumbnail';