Project

General

Profile

Actions

Bug #31288

closed

TCA renderMode "tree" issue

Added by Gabriel Kaufmann / Typoworx NewMedia over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Priority:
-- undefined --
Category:
Backend API
Target version:
-
Start date:
2011-10-25
Due date:
% Done:

0%

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

Description

I am trying to implement the new renderMode "tree" feature in TCA for a custom database-table.

I am using IRRE to build a tree using the "irre_parentid"-field used for IRRE. Now I also need a TREE that is able to list all IRRE-Records in their correct order/relation.

I tried to implement the rendermode->tree for pages which works perfectly and shows a tree with relation between each uid/pid relation just as known from BE-PageTree.


[...]
'config' => array (
'type' => 'select',
'renderMode' => 'tree',
'treeConfig' => array(
'parentField' => 'pid',
'appearance' => array(
'expandAll' => true,
'showHeader' => true,
'nonSelectableLevels' => '',
),
),
'foreign_table' => 'pages',
),
[...]

Now I need this whereas the pid-Field just would need to be replaced with "irre_parentid" which is used in IRRE-Records to reference to the parent-record "uid". I should mention that the IRRE-Records are shown correctly (even with correct nesting between uid/irre_parentid).


[...]
'config' => array (
'type' => 'select',
'renderMode' => 'tree',
'treeConfig' => array(
'parentField' => 'irre_parentid',
'appearance' => array(
'expandAll' => true,
'showHeader' => true,
'nonSelectableLevels' => '',
),
),
'foreign_table' => 'tx_tnmnicefaq_items',
),
[...]

Now this doesn't return any records and shows only the table-name as "root" without any childs!

Where is the problem?

Actions #1

Updated by Gabriel Kaufmann / Typoworx NewMedia over 12 years ago

I just did some debugging and noticed how to make it work.

I added the following for testing purposes and now the Tree returns the tree perfectly.
I know that this isn't a perfect solution - but there's something that seems to block the correct processing within the MySQL Query:

[...]
'config' => array (
'type' => 'select',
'renderMode' => 'tree',
'treeConfig' => array(
'parentField' => 'irre_parentid',
'appearance' => array(
'expandAll' => true,
'showHeader' => true,
'nonSelectableLevels' => '',
),
),
'foreign_table' => 'tx_tnmnicefaq_items',
// Added for testing purposes:
'foreign_table_where' => 'OR 1',
),
[...]

I know this is a very dirty hack! But it will deliver the tree based on IRRE-Nesting as wanted.
I hope there's a better solution to fix this - saving the tree-selection still doesn't work!
There seems to be anything that blocks the correct Query.

To have a quick + dirty fix I added the following to TCA to have a more or less "save" hack until there's a better solution:
'foreign_table_where' => 'OR (' .
ltrim(t3lib_BEfunc::BEenableFields('tx_tnmnicefaq_items'),'AND ').
'AND tx_tnmnicefaq_items.pid IN'.
')',

Actions #2

Updated by Jeff Segars over 12 years ago

  • Category set to Backend API
  • Complexity set to easy

Gabriel,
Thanks for the bug report. Do you happen to know offhand if the issue occurs under TYPO3 4.5 also or is unique to 4.6?

Thanks,
Jeff

Actions #3

Updated by Gabriel Kaufmann / Typoworx NewMedia over 12 years ago

Jeff Segars wrote:

Gabriel,
Thanks for the bug report. Do you happen to know offhand if the issue occurs under TYPO3 4.5 also or is unique to 4.6?

Thanks,
Jeff

Hello Jeff,

I changed the TYPO3-src symlink back to 4.5.5 - there's no change for the issue.

Please note that even with my "quick & dirty" hack shown above, saving the selection still is ignored/not saved.

Thanks,
Gabriel

Actions #4

Updated by Gabriel Kaufmann / Typoworx NewMedia over 12 years ago

Jeff Segars wrote:

Gabriel,
Thanks for the bug report. Do you happen to know offhand if the issue occurs under TYPO3 4.5 also or is unique to 4.6?

Thanks,
Jeff

Hello Jeff,

I changed the TYPO3-src symlink back to 4.5.5 - there's no change for the issue.

Please note:
  1. that even with my "quick & dirty" hack shown above, saving the selection still is ignored/not saved.
  2. I also checked if values saved in the DB-Field (by hand using phpMyAdmin) are NOT pre-selected in the tree (using my hack above).

So there seem to be this problems:
- At first there seems to block something that I can use my TCA-Code for the "irre_parentid"-field. I also did a check against "pages"-table by using pid and a new-field "test" containing the pid-value in every record. This works fine!
- There "may" be some problem/blocking for saving the values into the record. The IRRE-Records consist of a usual record (in my case for one of my own extensions) extended with this fields. Using my hack-code to get the tree rendered I am not able to save the tree records selected within the tree (tested on TYPO3 4.5.5 and 4.5.6).


CREATE TABLE tx_tnmnicefaq_items (
[...]
irre_parentid int(11) DEFAULT '0' NOT NULL,
irre_referenceid tinytext NOT NULL,
irre_parenttable tinytext NOT NULL,
[...]
);

The irre_parentid is used to have a back-reference to the same table (nested childs) by IRRE which works fine (expect the additional required tree based on this records). If you need some further informations on this, please let me know.

Thanks,
Gabriel

Actions #5

Updated by Gabriel Kaufmann / Typoworx NewMedia over 12 years ago

Hello Jeff,

I just tried to implement a default-list as alternative to the currently non-working treeView. And then I noticed that there seems to occurs the same problem as in the tree. What can this be? Did I forgot to add any option or db-field that is mandatory here?


[...]
'type' => 'select',
'foreign_table' => 'tx_tnmnicefaq_items',
'foreign_table_where' => 'AND tx_tnmnicefaq_items.pid=###STORAGE_PID### ORDER BY tx_tnmnicefaq_items.uid',
'size' => 10,
'minitems' => 0,
'maxitems' => 2,
[...]

Here's my current DB-Setup (tables.sql):

#
  1. Table structure for table 'tx_tnmnicefaq_items' #
    CREATE TABLE tx_tnmnicefaq_items (
    uid int(11) NOT NULL auto_increment,
    pid int(11) DEFAULT '0' NOT NULL,
    tstamp int(11) DEFAULT '0' NOT NULL,
    crdate int(11) DEFAULT '0' NOT NULL,
    cruser_id int(11) DEFAULT '0' NOT NULL,
    t3ver_oid int(11) DEFAULT '0' NOT NULL,
    t3ver_id int(11) DEFAULT '0' NOT NULL,
    t3ver_wsid int(11) DEFAULT '0' NOT NULL,
    t3ver_label varchar(30) DEFAULT '' NOT NULL,
    t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
    t3ver_stage tinyint(4) DEFAULT '0' NOT NULL,
    t3ver_count int(11) DEFAULT '0' NOT NULL,
    t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
    t3_origuid int(11) DEFAULT '0' NOT NULL,
    sys_language_uid int(11) DEFAULT '0' NOT NULL,
    l10n_parent int(11) DEFAULT '0' NOT NULL,
    l10n_diffsource mediumtext,
    sorting int(10) DEFAULT '0' NOT NULL,
    deleted tinyint(4) DEFAULT '0' NOT NULL,
    hidden tinyint(4) DEFAULT '0' NOT NULL,
    starttime int(11) DEFAULT '0' NOT NULL,
    endtime int(11) DEFAULT '0' NOT NULL,
    fe_group int(11) DEFAULT '0' NOT NULL,
    title varchar(255) DEFAULT '' NOT NULL,
    type int(11) DEFAULT '0' NOT NULL,
    bodytext text,
    items int(11) DEFAULT '0' NOT NULL,
    files text,
    files_description text,
    link tinytext,

    irre_parentid int(11) DEFAULT '0' NOT NULL,
    irre_referenceid tinytext NOT NULL,
    irre_parenttable tinytext NOT NULL,

    PRIMARY KEY (uid),
    KEY parent (pid),
    KEY t3ver_oid (t3ver_oid,t3ver_wsid)
    );

Actions #6

Updated by Gabriel Kaufmann / Typoworx NewMedia over 12 years ago

I was able to solve the issue saving the records. Sorry - it was my fault.

Now I am able to render a select-list OR a treeView - but only using my hack provided above. This issue still exists.

Actions #7

Updated by Gabriel Kaufmann / Typoworx NewMedia over 12 years ago

Hello Jeff,

sorry for bugging you with all my updates. I have some success in fixing my issue. The reported issue seems to be solved. For any reason I forgot to add the field "irre_parenttable" properly to TCA.

I've added now both irre-fields to TCA as type "passthrough"


'irre_parentid' => array (
'config' => array (
'type' => 'passthrough',
)
),
'irre_parenttable' => array (
'config' => array (
'type' => 'passthrough',
)
),

This seems to solve the reported problem (I don't need my "hack" anymore!!). But now I get another issue.

The treeView works, but after changing something in it by selecting a record and saving the whole bunch,
TYPO3 does reload the whole view (TCE Form in BE), but now the treeView will be shown as "empty" with it's root-record only.
Another reload without save shows the treeView again correctly and even with the item selected previously.

Update:
The recent issue seem to be part of a custom processDatamapPostProcFieldArray / processDatamapClass Hook used in my extension. Disabling them seems to solve the problem. I will have to do some research here.

Thanks for your help!

PLEASE CLOSE / SOLVED!

best regards
Gabriel

Actions #8

Updated by Francois Suter over 12 years ago

  • Status changed from New to Rejected
  • Assignee set to Francois Suter
  • Priority changed from Should have to -- undefined --

Closing at the request of the reporter.

Gabriel, thanks for your detailed reports and for following through with the resolution.

Actions

Also available in: Atom PDF