Skip to content

Commit

Permalink
fix(Tinebase): client side grouping not working for record fields
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusweiss committed Feb 24, 2025
1 parent 5a2d4a1 commit 756a141
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
13 changes: 13 additions & 0 deletions tine20/Tinebase/js/data/GroupedStoreCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* @copyright Copyright (c) 2017 Metaways Infosystems GmbH (http://www.metaways.de)
*/

import recordMgr from './RecordMgr'
import Record from './Record'

Ext.ns('Tine.Tinebase.data');

/**
Expand Down Expand Up @@ -159,6 +162,16 @@ Ext.extend(Tine.Tinebase.data.GroupedStoreCollection, Ext.util.MixedCollection,
groupNames = [groupNames];
}

groupNames = groupNames.map((groupName) => {
if (_.isObject(groupName) && ! _.isFunction(groupName.getTitle) && _.isString(this.group)) {
const conf = _.get(record.constructor.getField(this.group), 'fieldDefinition.config');
let recordClass
if (conf && conf.appName && conf.modelName && (recordClass = recordMgr.get(conf.appName, conf.modelName))) {
return Record.setFromJson(groupName, recordClass)
}
}
return groupName;
})
groupNames = await this.sanitizeGroupNames(groupNames);

if (this.fixedGroups.length) {
Expand Down
7 changes: 5 additions & 2 deletions tine20/Tinebase/js/data/Record.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

const { apply, extend, isPrimitive, isArray, isString } = require("Ext/core/core/Ext");
const { emptyFn } = require("Ext/core/Ext-more");
const { lowerFirst, get, find, forEach, isFunction, isObject, indexOf, map, difference, compact } = require('lodash');
const { lowerFirst, get, set, find, forEach, isFunction, isObject, indexOf, map, difference, compact } = require('lodash');
const ExtRecord = require("Ext/data/Record");
const MixedCollection = require("Ext/util/MixedCollection");
const Field = require("Ext/data/DataField");
Expand Down Expand Up @@ -180,7 +180,10 @@ extend(Record, ExtRecord, {
this.afterEdit();
}
},


getData: function() {
return set(ExtRecord.prototype.getData.call(this), '__meta.recordClass', `${this.appName}.${this.modelName}`);
},
/**
* returns title of this record
*
Expand Down

0 comments on commit 756a141

Please sign in to comment.