[TYPO3-mvc] *Store* sorting a of relation

Dirk Rauscher dr_typo3 at itb-institut.de
Mon Mar 5 11:52:05 CET 2012


Hi Lorenz

again I assume the following situation:

Your 'group of works' object lists the assigned 'work' objects in the 
frontend. The frontend users then clicks on e.g. the property name to 
sort them by name.

You can either store the click event in a variable of the form and 
submit it when the fe user clicks the 'save' button. Or submit it with 
an ajax call directly.

Of course this requires javascript to do the job. If JS isn't enabled 
you use a default sorting.

--------------------------------
<form name="xxx" method="xxx">
...
...

<input type="hidden" name="tx_yourExt_pi1[mySorting]" value="name ASC">
</form>
--------------------------------

Dirk



Am 02.03.2012 14:59, schrieb Lorenz Ulrich:
> Hi Dirk
>
> I have the following situation:
>
> - An "exhibition" object
> -- having a relation to n "group of works" objects
> --- which have a relation to n "work" objects
>
> When adding works to a "group of works", I want to store the sorting of
> these works inside the "group of works". I don't know how I could store
> that sorting in a field in the "group of works" table.
>
> At the same time I cannot store the sorting inside the "work" table
> because there are other objects relating to the "work" table, e.g.
>
> - An "artist" object
> -- having a relation to n "work" objects
>
> The artist may have another sorting of his works than the "gallery
> owner" creating topic-based groups of works.
>
> Do I miss something?
>
> Thanks for contributing.
>
> Lorenz
>
> Am 02.03.2012 14:10, schrieb Dirk Rauscher:
>> I assume you have a 'documentgroup' object that holds the 'documents'.
>> And a 'user' object which has one or more 'documentgroups' to handle the
>> user's documents.
>>
>> So I would add a 'sorting' field to the 'documentsgroup' object and use
>> it when querying the documents with a repository method eg.
>> findByDocumentgroup() instead of adding the sorting to the MM table.
>>
>> $query->setOrderings(array('mySortingField' =>
>> Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING))
>>
>> How about that?
>>
>>
>> Kind regards,
>> Dirk
>>
>>
>>


More information about the TYPO3-project-typo3v4mvc mailing list