Skip to content

Commit

Permalink
[BUGFIX] Handle sorting of nested IRRE containers properly
Browse files Browse the repository at this point in the history
When sorting elements in an IRRE container, the sorting took
grandchildren into account as well, which broke the sorting in the
database.

With this patch, a new data attribute is added to be able to identify
direct ancestors and limit sorting to these records only.

Resolves: #92804
Releases: master, 10.4
Change-Id: I09876c3a8be45b060c133d758807e4df25fee0d2
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66933
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Richard Haeser <richard@richardhaeser.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Richard Haeser <richard@richardhaeser.com>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
  • Loading branch information
andreaskienast committed Jan 6, 2021
1 parent 93ac43c commit d94b1b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,8 @@ class InlineControlContainer {
}

const recordListContainer = <HTMLDivElement>document.getElementById(this.container.getAttribute('id') + '_records');
const records = Array.from(recordListContainer.querySelectorAll('[data-placeholder-record="0"]')).map((child: HTMLElement) => child.dataset.objectUid);
const records = Array.from(recordListContainer.querySelectorAll('[data-object-parent-group="' + this.container.dataset.objectGroup + '"][data-placeholder-record="0"]'))
.map((child: HTMLElement) => child.dataset.objectUid);

(<HTMLInputElement>formField).value = records.join(',');
(<HTMLInputElement>formField).classList.add('has-change');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public function render()
'data-object-uid' => $record['uid'],
'data-object-id' => $objectId,
'data-object-id-hash' => $hashedObjectId,
'data-object-parent-group' => $domObjectId . '-' . $foreignTable,
'data-field-name' => $appendFormFieldNames,
'data-topmost-parent-table' => $data['inlineTopMostParentTableName'],
'data-topmost-parent-uid' => $data['inlineTopMostParentUid'],
Expand Down
Loading

0 comments on commit d94b1b5

Please sign in to comment.