Closed hotlines-studio closed 4 years ago
I fear that sortable won't ever work because of the nature of this plugin. This plugin is about displaying query results, not about changing them; therefore no "adding" and no "sorting".
Sorting is done by changing the number in front of the folder names of your pages, this is an action that is done to all siblings of a page and not only a single page. E.g. you take the last page (let's say nr. 8) and you drag it in first place: this causes page 8 to become 1, page 1 becomes 2, page 2 becomes 3, etc. Now in your example, when sorting, you don't see all the affected siblings, because some of them don't match your filter. Therefore the status of the hidden pages would be undefined after sorting; as an example let's say page 1 is hidden, page 2 is visible, page 3 is hidden, page 4 is visible. You drag page 4 (which you see as page 2) before page 2 (which you see as page 1), the panel see's this sorting as "drag page 4 to page 1" and what happens to real (but invisible) pages 1 and 3 is undefined: i.e. should page 4 be set as page 2 or 1? The panel doesn't see whether you dragged the page before or after the not included pages.
In your example we could now come up with some arbitrary rule to handle the situation, but there are other situations (that this plugin wants to support) where having a "sort" really doesn't make sense; just think about a query that returns pages from multiple parents.
To solve your issue: you can still sort your pages by adding a normal "pages section" in your "work" page, where you see all children.
Or you could think about structuring your content like this:
- work
- categoryA
- project1
- project2
- categoryB
- project3
- project4
This way you also don't need a "selectCategory" field, which anyway would risk to become "out of sync" when you, for example, change the name of a category.
That all makes sense, I appreciate the detailed explanation!
I wish I could do the provided solution, haha, but the nature of this situation I'm in is pretty complex. The client wants their projects in a master list that they can rearrange (basic pages field section in a blueprint). So essentially, we have all of these projects, and each project has a select field to choose an optional work category to be tied to (or no category if left unselected). These work category pages are dynamic and sortable, so I can't control the pages field structure in the blueprints. Now the client wants to go into one of these dynamically created work category page and then sort the projects that were tied to the given page and put these in a different order. This isn't a normal flow or request, so I don't expect an answer, haha, I just need to get creative and rethink this a bit more in the panel and see how to do this. Ran in to issues where a project was tied to a work category but then if you change which category it was tied to, it wouldn't update in that old / new work category page automatically - I'll have to use a hook on some page change / update and add or unset pages in the yaml array, or something along those lines I think... hah.
Thanks again for your time!
if they want to rearrange (i.e. sort) the projects in both the "master work page list", but also the "category pages", and possibly have them in different orderings, having only one sorting number is mathematically not enough ;)
If this is the case, having only pages sections (of any kind) won't ever be enough. However, I think the forum is better place for this kind of questions where you'll probably find a more diverse set of options as answers :).
First off, great plugin, thanks! I'm trying to display all pages tied to a specific work category (in my example here) and allow this list to be sortable:
But in the work category page, there is no way to drag and drop / sort the list of projects. Is there another way
sortable: true
can work in the yaml file, or even in the plugin itself?Thanks!