Aristeidis Karavas
Aristeidis Karavas

Reputation: 1956

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,

Upvotes: 0

Views: 1371

Answers (2)

Aristeidis Karavas
Aristeidis Karavas

Reputation: 1956

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.

Upvotes: 0

Bernd Wilke πφ
Bernd Wilke πφ

Reputation: 10791

when you fetch the the inline elements you need to take the sorting column into account. that would happen primarily in the DB request which probably is done in your domain controller. maybe you need to redefine some methods.

If you use the build-in functions of TYPO3 you need to configure your relation accordingly.
Looking into the manual I find the value foreign_sortby where you declare the sorting field. maybe you just use the default field sorting.

Upvotes: 1

Related Questions