Skip to content

Commit

Permalink
T892331 fix custom fields data display (#13205)
Browse files Browse the repository at this point in the history
  • Loading branch information
zelik88 authored May 26, 2020
1 parent ee67ec7 commit aea132a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion js/ui/gantt/ui.gantt.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,9 @@ class Gantt extends Widget {
}
_appendCustomFields(data) {
const modelData = this._tasksOption._getItems();
const keyGetter = dataCoreUtils.compileGetter(this.option(`${GANTT_TASKS}.keyExpr`));
return data.reduce((previous, item) => {
const modelItem = modelData && modelData.filter((obj) => obj.id === item.id)[0];
const modelItem = modelData && modelData.filter((obj) => keyGetter(obj) === keyGetter(item))[0];
if(!modelItem) {
previous.push(item);
} else {
Expand Down
8 changes: 4 additions & 4 deletions testing/tests/DevExpress.ui.widgets/gantt.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,12 +861,12 @@ QUnit.module('Parent auto calculation', moduleConfig, () => {
const start = new Date('2019-02-19');
const end = new Date('2019-02-26');
const tasks = [
{ 'id': 1, 'parentId': 0, 'title': 'Software Development', 'start': new Date('2019-02-21'), 'end': new Date('2019-02-22'), 'progress': 0, 'customField': 'test0' },
{ 'id': 2, 'parentId': 1, 'title': 'Scope', 'start': new Date('2019-02-20'), 'end': new Date('2019-02-20'), 'progress': 0, 'customField': 'test1' },
{ 'id': 3, 'parentId': 2, 'title': 'Determine project scope', 'start': start, 'end': end, 'progress': 50, 'customField': 'test2' }
{ 'idKey': 1, 'parentId': 0, 'title': 'Software Development', 'start': new Date('2019-02-21'), 'end': new Date('2019-02-22'), 'progress': 0, 'customField': 'test0' },
{ 'idKey': 2, 'parentId': 1, 'title': 'Scope', 'start': new Date('2019-02-20'), 'end': new Date('2019-02-20'), 'progress': 0, 'customField': 'test1' },
{ 'idKey': 3, 'parentId': 2, 'title': 'Determine project scope', 'start': start, 'end': end, 'progress': 50, 'customField': 'test2' }
];
const options = {
tasks: { dataSource: tasks },
tasks: { dataSource: tasks, keyExpr: 'idKey', },
validation: { autoUpdateParentTasks: true },
columns: [{
dataField: 'customField',
Expand Down

0 comments on commit aea132a

Please sign in to comment.