Search code examples
typo3typo3-8.7.xtypo3-tca

TYPO3 Inline element sorting does not work correctly


After this post TYPO3 Inline element appearance configuration partially does not work i was able to achive what i wanted. The problem now, is that when i drag a child up or down, the sorting thing won't work.

The image:

enter image description here

Now when i move the children in a different position (either with the arrows or the burger menu sign), the new order will be saved in backend, but in frontend the order won't change. I assume it has something to do with the database, but at this point i have no idea what to do.

EDIT: On my database i have the column sorting, and for every item is different. How can i use this column to order the elements?

Code Example:

<f:for each="{myContent}" as="content">
      <f:format.html>{content.data.content_text}</f:format.html>
</f:for>

Any ideas?

Thanks in advance,


Solution

  • I finally found the problem. Since i do not have a domain model, i used dataProccessing in order to get my objects. So, all i had to do is to add a line which was orderBy = sorting. So the code looks like this:

    myElement < lib.contentElement
    myElement {
        templateRootPaths.10 = {$Private}Templates/ContentElements/
        partialRootPaths.10 = {$Private}Partials/ContentElements/
        templateName = myElement.html
        dataProcessing {
            330 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
            330 {
                table = myElement_table
                pidInList = this
                where.field = uid 
                where.dataWrap = tt_content = |
                orderBy = sorting
                as = myElement
                dataProcessing {
                    370 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
                    370 {
                        references.fieldName = image
                        as = images
                    }
                }
            }
        }
    }
    

    Problem solved.

    A big thank you to @Bernd Wilke πφ for trying to help me with literally all my TYPO3 questions.