Bug #25347

TCA type "select", renderMode "tree", maxitems = 1 doesn't work

Added by Marco Huber about 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2011-03-16
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I want to use the new TCA tree, but when I configure 1 as maxitems I can't select a tree node.

This happens, because this.countSelectedNodes in t3lib\js\extjs\tree\tree.js is 1 even when I create a new record. And this.countSelectedNodes is 1 because $valueArray in t3lib\tceforms\class.t3lib_tceforms_tree.php in the function renderField always has at least one entry.

$valueArray is created by exploding $PA['itemFormElValue']. In fresh records $PA['itemFormElValue'] is 0 and not NULL (or not set) and has no other effects. But $valueArray has an entry and that's why count($valueArray) is 1 and then this.countSelectedNodes is also 1.

To fix this issue $PA['itemFormElValue'] should be only exploded when it's not 0. Like I worte, this is done in t3lib\tceforms\class.t3lib_tceforms_tree.php and fixed in the appended patch.

Fixing this issue causes a little follow up in t3lib\js\extjs\tree\tree.js. This is also fixed in the patch.

I hope the patch file's syntax is correct, this is my first git patch ;-)

(issue imported from #M17976)


Files

fix_tcatree_maxitem1.patch (1.74 KB) fix_tcatree_maxitem1.patch Administrator Admin, 2011-03-16 16:53

Related issues

Has duplicate TYPO3 Core - Bug #25820: maxitems is not working correctly in tcaTreeClosedSteffen Kamper2011-04-07

Actions
#1

Updated by Marco Huber about 10 years ago

To reproduce this issue you can use this TCA (Thanks to Steffen: http://lists.typo3.org/pipermail/typo3-team-core/2010-November/044931.html):
$GLOBALS['TCA']['pages']['columns']['fe_group']['config']['renderMode'] = 'tree';
$GLOBALS['TCA']['pages']['columns']['fe_group']['config']['maxitems'] = 1;
$GLOBALS['TCA']['pages']['columns']['fe_group']['config']['treeConfig'] = array(
'parentField' => 'subgroup',
'appearance' => array(
'expandAll' => TRUE,
'showHeader' => TRUE,
)
);

#3

Updated by Anonymous about 10 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
#4

Updated by Helmut Hummel about 10 years ago

  • Status changed from Resolved to Under Review
  • Target version changed from 0 to 4.5.3

In master this was merged: https://review.typo3.org/1188
In 4-5 there is a nicer version of this panding: https://review.typo3.org/1211

I still prefer this in favour of what is suggested in #25820

#5

Updated by Marco Huber about 10 years ago

  • Status changed from Under Review to Resolved
#6

Updated by Oliver Hader almost 10 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF