Commit dc06bd58 authored by Alexander Bigga's avatar Alexander Bigga Committed by Frans Saris
Browse files

[BUGFIX] Allow maxitem=1 in TCA treeSelect again

Introduced with ec7b2297 #75519, it was not possible to set maxitem=1 to
TCA treeSelect. This occures e.g. on setting the parent of a
sys_category.

The reason is the "selected" array which gets initialized with all
selected items. If there is no item selected, it is initialized with an
empty value and "selected.lenght" is 1 but should be 0. Selecting a new
value is impossible now.

The proposed path checks if items are selected or not on
initialization.

Change-Id: I0c8d21ad753dccb2d993febde404afc83a39b9b3
Resolves: #75947
Releases: master, 7.6, 6.2
Reviewed-on: https://review.typo3.org/47940


Reviewed-by: default avatarMarkus Sommer <markussom@posteo.de>
Tested-by: default avatarMarkus Sommer <markussom@posteo.de>
Tested-by: default avatarPhilipp Wrann <philippwrann@gmail.com>
Reviewed-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Reviewed-by: Frans Saris's avatarFrans Saris <franssaris@gmail.com>
Tested-by: Frans Saris's avatarFrans Saris <franssaris@gmail.com>
parent 5ccdeb32
......@@ -197,7 +197,7 @@ TYPO3.Components.Tree.EmptySelectionModel = new Ext.tree.DefaultSelectionModel({
TYPO3.Components.Tree.TcaCheckChangeHandler = function(checkedNode, checked) {
var exclusiveKeys = this.tcaExclusiveKeys.split(','),
uid = '' + checkedNode.attributes.uid,
selected = Ext.fly('treeinput' + this.id).dom.value.split(',');
selected = Ext.fly('treeinput' + this.id).dom.value.length ? Ext.fly('treeinput' + this.id).dom.value.split(',') : [];
this.suspendEvents();
......
Supports Markdown
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