Commit e9b95131 by kevalbhatt

ATLAS-2244 : UI - Basic Search Table not using referredEntities to render entity details

parent 3b9ea1dd
......@@ -510,15 +510,24 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
titleBoxEl.fadeIn();
}
Utils.findAndMergeRefEntity = function(attributeObject, referredEntities) {
var megeObject = function(obj) {
if (obj) {
if (obj.attributes) {
Utils.findAndMergeRefEntity(obj.attributes, referredEntities);
} else if (referredEntities[obj.guid]) {
_.extend(obj, referredEntities[obj.guid]);
}
}
}
if (attributeObject && referredEntities) {
_.each(attributeObject, function(obj, key) {
if (_.isObject(obj)) {
if (_.isArray(obj)) {
_.each(obj, function(value) {
_.extend(value, referredEntities[value.guid]);
megeObject(value);
});
} else {
_.extend(obj, referredEntities[obj.guid]);
megeObject(obj);
}
}
});
......
......@@ -241,7 +241,7 @@ define(['require',
}
this.triggerUrl();
var attributes = this.searchCollection.filterObj.attributes;
if (excludeDefaultColumn && attributes && excludeDefaultColumn.length > attributes.length) {
if ((excludeDefaultColumn && attributes) && (excludeDefaultColumn.length > attributes.length || _.difference(excludeDefaultColumn, attributes).length)) {
this.fetchCollection(this.value);
}
}
......@@ -410,10 +410,12 @@ define(['require',
return;
}
if (isPostMethod) {
that.searchCollection.referredEntities = dataOrCollection.rnoRecordFoeferredEntities;
that.searchCollection.referredEntities = dataOrCollection.referredEntities;
Utils.findAndMergeRefEntity(dataOrCollection.entities, dataOrCollection.referredEntities);
that.searchCollection.reset(dataOrCollection.entities, { silent: true });
}
/*Next button check.
It's outside of Previous button else condition
because when user comes from 2 page to 1 page than we need to check next button.*/
......@@ -712,17 +714,14 @@ define(['require',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
var modelObj = model.toJSON();
if (modelObj && modelObj.attributes && !_.isUndefined(modelObj.attributes[key])) {
var tempObj = {
'scope': that,
'attributeDefs': [obj],
'valueObject': {},
'isTable': false
}
tempObj.valueObject[key] = modelObj.attributes[key]
Utils.findAndMergeRefEntity(tempObj.valueObject, that.searchCollection.referredEntities);
};
tempObj.valueObject[key] = modelObj.attributes[key];
return CommonViewFunction.propertyTable(tempObj);
}
}
......@@ -770,10 +769,8 @@ define(['require',
// 'attributeDefs':
'valueObject': {},
'isTable': false
}
tempObj.valueObject[key] = modelObj[key]
Utils.findAndMergeRefEntity(tempObj.valueObject, that.searchCollection.referredEntities);
};
tempObj.valueObject[key] = modelObj[key];
return CommonViewFunction.propertyTable(tempObj);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment