Bug #75519
closedFlexform select rendermode tree doesn't respect collapsed nodes
100%
Description
When using a select field in your plugin flexform with rendermode tree the collapsed nodes state isn't saved. So you lose the selection of all subnodes of collapsed nodes after save.
My config:
<settings.mediaAlbumsUids> <TCEforms> <label>LLL:EXT:fs_media_gallery/Resources/Private/Language/locallang_be.xlf:flexforms.mediagallery.mediaAlbumsUids</label> <displayCond>FIELD:switchableControllerActions:IN:MediaAlbum->nestedList;MediaAlbum->showAsset,MediaAlbum->randomAsset</displayCond> <config> <type>select</type> <renderMode>tree</renderMode> <treeConfig> <parentField>parentalbum</parentField> <appearance> <showHeader>TRUE</showHeader> <width>650</width> </appearance> </treeConfig> <internal_type>db</internal_type> <size>5</size> <autoSizeMax>20</autoSizeMax> <maxitems>1000</maxitems> <minitems>0</minitems> <foreign_table>sys_file_collection</foreign_table> <foreign_table_where>AND sys_file_collection.hidden = 0 AND (sys_file_collection.sys_language_uid = 0 OR sys_file_collection.l10n_parent = 0) ORDER BY sys_file_collection.sorting ASC, sys_file_collection.crdate DESC</foreign_table_where> </config> </TCEforms> </settings.mediaAlbumsUids>
Reproducible with https://typo3.org/extensions/repository/view/fs_media_gallery/ and a lot of nested albums (file collections)
Files
Updated by Frans Saris over 8 years ago
It only looses the "hidden" values when an visible node is changed.
Updated by Gerrit Code Review over 8 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47812
Updated by Gerrit Code Review over 8 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47812
Updated by Gerrit Code Review over 8 years ago
Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47899
Updated by Gerrit Code Review over 8 years ago
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47900
Updated by Frans Saris over 8 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 4e8a2efce7d5012fed6ae01c4190c1917739ae64.
Updated by Jörg Hambuch almost 8 years ago
In TYPO3 6.2 (starting from version 6.2.22) this bugfix prevents the category tree from being displayed. Frans, could you please check with 6.2 again?
Updated by Frans Saris almost 8 years ago
Hi Jörg,
In what situation does the category tree fail to render (normal TCA, IRRE, flexform, after creating new record, ....)? Do you get a JavaScript error? You are an latest release of 6.2?
Because for my current use-cases it works on latest 6.2
Groet Frans
Updated by Daniel Hirth almost 8 years ago
- File 2016-10-20_12h18_57.png 2016-10-20_12h18_57.png added
Frans Saris wrote:
Hi Jörg,
In what situation does the category tree fail to render (normal TCA, IRRE, flexform, after creating new record, ....)? Do you get a JavaScript error? You are an latest release of 6.2?
Because for my current use-cases it works on latest 6.2
Groet Frans
Hi,
I seem to have the same problem as Jörg. My TYPO3 Version is 6.2.27.
An Extbase Model "StaffMember" has a property "roles", which is a StorageObject on a Model "Role". The TCA for the property:
'roles' => array( 'exclude' => 1, 'label' => '...', 'config' => array( 'type' => 'inline', 'foreign_table' => '..._domain_model_role', 'foreign_field' => 'staffmember', 'maxitems' => 999, 'appearance' => array( 'collapseAll' => 1, 'levelLinksPosition' => 'top', 'showSynchronizationLink' => 1, 'showPossibleLocalizationRecords' => 1, 'showAllLocalizationLink' => 1 ), ), ),
The model "Role" itself has a property "Categories", whose TCA is auto-generated via
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable( $_EXTKEY,'...domain_model_role','categories',$options = array( ) );
Now, when openening a Role-Element directly in BE List Module, all categories are shown correctly. When opening a StaffMember-Element, then clicking on a collapsed Child-Role of this Element, the Role gets loaded correctly BUT the category tab is empty. The whole treeview is missing except for the heading (see screenshot).
When changing the setting "collapseAll" to "0", the category trees of the Child-Roles are displayed correctly.
When manually resetting the Patch 4e8a2efce7d5012fed6ae01c4190c1917739ae64 in tree.js, the category trees of the Child-Roles are displayed correctly event with the collapseAll setting. The lines 63-70 of the patch seem to be responsible, when replacing them with
var selected = [];
everything seems to be working fine again. A fix for this would be really welcome.
Updated by Frans Saris almost 8 years ago
This part is one of the main parts of the fix:
// prepare hidden input field (make sure only comma separated uids are present) var selected = Ext.fly('treeinput' + this.id).dom.value.split(','); for (var i = 0; i < selected.length; i++) { var value = selected[i].split('|'); selected[i] = value[0]; } Ext.fly('treeinput' + this.id).dom.value = selected.join(',');
Could you test if this fixed it for you?
// prepare hidden input field when found (make sure only comma separated uids are present) if (Ext.fly('treeinput' + this.id)) { var selected = Ext.fly('treeinput' + this.id).dom.value.split(','); for (var i = 0; i < selected.length; i++) { var value = selected[i].split('|'); selected[i] = value[0]; } Ext.fly('treeinput' + this.id).dom.value = selected.join(','); }
Please check if the states of the checkboxes that aren't visible are kept.
So collapse some checked leaves, save record twice and check if the checkbox is still checked by expanding the leaves again.
Updated by Benni Mack almost 6 years ago
- Status changed from Resolved to Closed