I'm building an extension to display lists of entries via tables in the frontend.
Right now I'm trying to come up with a way to keep orderings, limit and offset the same between calls. I already tried to write those into respective variables in the repository. But as with the setDefaultOrderings() it only works if you call that function before a findAll() call to set the orderings for this specific call and not all consecutive calls. I guess it will be the same with the controller. So my only option is through hidden form-elements.
But is there actually a right way to do this? Or does it HAVE to be through form-elements? Is there some kind of persistency object I can call on to make these variables persistent? I guess it would not be the persistenceManager.
Thanks in advance!
CodePudding user response:
Depending on your case, you can store the filters, orderings (and perhaps pagination page or „offset“) into the fe_user session. You should encapsulate the variables into an own „demand“ or „filter“ object. You can use this object to bind the fluid form elements onto.
If you don’t want to store those things into a session object, you have to pass everything as arguments (get/post) at any place or generated link.
In addition you should have a custom „findByFilter($filter)“ repository query which handles all the passed (encapsulated) parameters. This is the place where you can also easily change the orderings dynamically.