Bug #75519

Flexform select rendermode tree doesn't respect collapsed nodes

Added by Frans Saris over 5 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2016-04-11
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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

2016-10-20_12h18_57.png (33.5 KB) 2016-10-20_12h18_57.png Daniel Hirth, 2016-10-20 12:27

Related issues

Related to TYPO3 Core - Bug #75947: Creation of subcategories impossible after upgrading to 6.2.22Closed2016-04-27

Actions
Related to TYPO3 Core - Bug #76374: Select trees not rendered on inline recordsClosed2016-05-30

Actions
Is duplicate of TYPO3 Core - Bug #74451: Select Tree does not save selected nodes that have never been expanded (collapsed on load and not expanded afterwards)Rejected2016-03-07

Actions
#1

Updated by Frans Saris over 5 years ago

  • Assignee set to Frans Saris
#2

Updated by Frans Saris over 5 years ago

It only looses the "hidden" values when an visible node is changed.

#3

Updated by Gerrit Code Review over 5 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

#4

Updated by Frans Saris over 5 years ago

  • Is Regression changed from Yes to No
#5

Updated by Gerrit Code Review over 5 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

#6

Updated by Gerrit Code Review over 5 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

#7

Updated by Gerrit Code Review over 5 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

#8

Updated by Frans Saris over 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#9

Updated by Jörg Hambuch about 5 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?

#10

Updated by Frans Saris about 5 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

#11

Updated by Daniel Hirth almost 5 years ago

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.

#12

Updated by Frans Saris almost 5 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.

#13

Updated by Benni Mack about 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF