processwire / processwire-issues

ProcessWire issue reports.
45 stars 2 forks source link

'Home' page disappears from page select if sorting by parent.name #1123

Closed jlahijani closed 2 years ago

jlahijani commented 4 years ago

Suppose you make a page select field with this selector string:

sort=parent.name,template!=admin

The "home" page will not appear.

However if you do this, it will appear:

sort=name,template!=admin
ryancramerdesign commented 4 years ago

@jlahijani The homepage has no parent, so a parent.name sort couldn't be performed on it. At least, if it were included, I'm not sure where it should appear in that scenario.

Toutouwai commented 4 years ago

At least, if it were included, I'm not sure where it should appear in that scenario.

Still, I think it should be included somewhere. This issue isn't specific to Page Reference fields, it affects PageFinder selectors generally (but not in-memory selectors).

2020-04-16_133507

The implication of "sort" is that it determines the order of items but not which items are included.

jlahijani commented 3 years ago

@ryancramerdesign Any new thoughts on this one now that you're on a binge of fixing various issues?

jlahijani commented 2 years ago

Note: I've worked around this by hooking into InputfieldPage::getSelectablePages and just populating the field options that way.

ryancramerdesign commented 2 years ago

@jlahijani Great, glad you found a way to work around it. I don't see a good way to support this because when you sort by something from another page (in the DB) it performs a join of the page holding the sortable value, and that requires that that page being sorted by is present, otherwise the page cannot participate in the selection, or the sort. So I don't think this is one that we can support in any straightforward way, as it's more an SQL behavior.