commit 5e39894af9501b1844824346e575de05bc8a8aad
parent ca57de77c5c04a0946b9bb838625e7e30d3150fa
Author: dromer <1185977+dromer@users.noreply.github.com>
Date: Wed, 5 Aug 2020 08:09:27 +0200
Merge pull request #1108 from DaniusKalv/PartKeepr-948
Fixes #948: Column field values not showing
Diffstat:
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Data/HydraModel.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Data/HydraModel.js
@@ -44,7 +44,7 @@ Ext.define("PartKeepr.data.HydraModel", {
return ret;
}
- if (this.associations[parts[0]]) {
+ if (this.associations[parts[0]] && this.getFieldType(parts[0]).type === "onetomany") {
role = this.associations[parts[0]];
item = role.getAssociatedItem(this);
@@ -59,14 +59,19 @@ Ext.define("PartKeepr.data.HydraModel", {
subEntity = parts[0].substring(0, openingBracket);
closingBracket = parts[0].indexOf("]", openingBracket);
index = parts[0].substring(openingBracket+1, closingBracket);
+ }
+ else {
+ // No index was passed for retrieving this field, try to return the first array member
+ subEntity = parts[0];
+ index = 0;
+ }
- subEntityStore = this[this.associations[subEntity].role]();
- item = subEntityStore.getAt(index);
+ subEntityStore = this[this.associations[subEntity].role]();
+ item = subEntityStore.getAt(index);
- if (item !== null) {
- parts.shift();
- return item.get(parts.join("."));
- }
+ if (item !== null) {
+ parts.shift();
+ return item.get(parts.join("."));
}
}
}
@@ -87,7 +92,7 @@ Ext.define("PartKeepr.data.HydraModel", {
for (i=0;i<this.fields.length;i++) {
if (this.fields[i].getName() === fieldName) {
if (this.fields[i].reference !== null) {
- ret = {
+ return {
type: "onetomany",
reference: this.fields[i].reference
};