Jump to content

Module: Admin Page Tree Multiple Sorting


David Karich
 Share

Recommended Posts

Admin Page Tree Multiple Sorting

ClassName: ProcessPageListMultipleSorting

Extend the ordinary sort of children of a template in the admin page tree with multiple properties. For each template, you can define your own rule. Write each template (template-name) in a row, followed by a colon and then the additional field names for sorting.

Example: All children of the template "blog" to be sorted in descending order according to the date of creation, then descending by modification date, and then by title. Type:

blog: -created, -modified, title 

Installation

  1. Copy the files for this module to /site/modules/ProcessPageListMultipleSorting/
  2. In admin: Modules > Check for new modules.
  3. Install Module "Admin Page Tree Multible Sorting".

Alternative in ProcessWire 2.4+

  1. Login to ProcessWire backend and go to Modules
  2. Click tab "New" and enter Module Class Name: "ProcessPageListMultipleSorting"
  3. Click "Download and Install"
 
Compatibility
 
I have currently tested the module only under PW 2.6+, but think that it works on older versions too. Maybe someone can give a feedback.
 
 
Download
 
 
 
I hope someone can use the module. Have fun and best regards,
David

post-1973-0-29192700-1438007284_thumb.pn

  • Like 9
Link to comment
Share on other sites

Really nice. I'm still waiting for sort=template to be added to the core as this can be really useful with page-tables, which add pages directly as children. 

To come to the feedback: 

  • The class Process already implements Module, so normally there's no need to implement it again, but …
  • The module shouldn't be a Process module in the first place, as it doesn't provide an interface for admin pages.
  • You can limit the autoload setting to only ProcessPageList, ProcessPageEdit (children tab)
Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

@David Karich Would it also be possible to use this to include drag-n-drop? I'm working with release 'year' (instead of date) but within the year I'd still like to drag-n-drop ?

So using your module something like...but then I'm not sure about the drag-n-drop;
books: -year, (drag-n-drop)

I figured I'd try it with the 'regular' sort setting -> first by -year and then back to drag-n-drop, but it of course doesn't remember the -year sorting as the last drag-n-drop. If that's possible I guess it also solves my issue. Let me know if it's possible with this – already awesome for other cases!! – module, or if you have an alternative idea!

cheers

 

Link to comment
Share on other sites

  • 1 year later...

hey there,

set it up like this:

basic-page: -created, -modified

but when i modify a page nothing changes. the most recent created page stays on top. (modified gets ignored).

am i missing something?

also: how to reflect the page listing on my frontend? -created AND -modified wouldn't work.

cheers

Link to comment
Share on other sites

  • 1 month later...

Brilliant, thx for this module! ? 

On 1/10/2020 at 11:00 PM, sww said:

set it up like this:

basic-page: -created, -modified

but when i modify a page nothing changes. the most recent created page stays on top. (modified gets ignored).

The sort order must be specified on the PARENT page, then all children get sorted. My setup:

news (template "news")
- news1 (template "newsitem")
- news2 (template "newsitem")
...

Then i set the sort to the "range" field (a timestamp of the first second of this day) and also created, so that pages that where created later are listed on top:

news: -range, -created
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...