From 9100aae7f352d09ab0a9b8e243a08ffdd64c4617 Mon Sep 17 00:00:00 2001 From: Alexander Bigga <alexander.bigga@slub-dresden.de> Date: Wed, 27 Apr 2016 15:50:31 +0200 Subject: [PATCH] [BUGFIX] Allow maxitem=1 in TCA treeSelect again Introduced with ec7b229 #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: 6.2 Reviewed-on: https://review.typo3.org/47937 Reviewed-by: Frans Saris <franssaris@gmail.com> Tested-by: Frans Saris <franssaris@gmail.com> --- typo3/sysext/backend/Resources/Public/JavaScript/tree.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/tree.js b/typo3/sysext/backend/Resources/Public/JavaScript/tree.js index 27b8495663a6..2ddbe2842266 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/tree.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/tree.js @@ -191,7 +191,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(); -- GitLab