Jump to content

PageTable doesn’t store re-ordering of items

Recommended Posts

PW: 2.7.3

User role: superuser

I have a page with a PageTable field. The field worked just fine, but suddenly when I re-order items in the PageTable on that page via drag and drop and hit save, the re-ordering doesn’t get saved and the old item order appears. Very odd …

The PageTable on all other pages with the same template work properly.

I tried to clone the problematic page, and tried to reproduce the problem, but I couldn’t on the cloned page! it works. I then deleted the original problematic page, and renamed the clone page to match the name of the original one (the cloned page had, of course, the "-1" suffix in the page name). After the renaming, the problem came back! So apparently my ProcessWire installation has a problem with the name of the problematic page (which is "/ueber-uns/" and "/about-us/" [it’s a multi-lingual setup], by the way, so nothing fancy).

I have no idea, how I can fix this issue, and I’m pretty nervous because the editors can’t change the appearance of the page due to this issue.

Share this post

Link to post
Share on other sites

I can't think of any reason why the page name would come into play for the sorting. What I would take a look at though is where your PageTable items are stored (common parent for all, vs. children of page being edited).

If using a common parent, look at the sort settings for that common parent on the Children tab, and make sure there isn't some predefined sort being applied. Likewise, look at the template used by that parent page and check the sort settings under the Family tab. 

If not using a common parent, then perform the same check as above, except for the page being edited (that page that contains the PageTable field). 

In your PageTable field settings, click the "Details" tab and review the "Sort fields" and make sure that it is blank. If it is blank already, go ahead and hit "save" anyway, just in case there's something caught in the field settings that needs to be refreshed. 

Share this post

Link to post
Share on other sites

Thanks for your response, Ryan.

I’m using a common parent for the PageTable items.

  • Sort setting on the page was blank, I changed that to "Manual drag and drop" and saved the page.
  • In the template of the common parent there was selected "None" in the children sorting setting. I changed that to "Manual drag-n-drop" and saved the template.
  • In the PageTable field there was nothing in the "Sort field" text field. I re-saved the field.

The problem still exists. Re-ordering items that are already part of the PageTable is not possible, also newly created items can’t get sorted (they can be only attached at the end of the list).

Again: this problem does not occur on other pages of the same template, with the same field, and thus with the same common parent. It seems to actually be only the mentioned problematic page in my first post. Also as written in my first post: cloning the problematic page, deleting the original one, and rename the cloned page to the name of the original problematic page, brings the problem back.

It’s absolutely weird.  :undecided:

Share this post

Link to post
Share on other sites

So the name isn't actually the trigger of the issue. Are there any hooks attached to this page, which aren't on the others? 

Share this post

Link to post
Share on other sites

Oh my goodness, now it’s getting really weird. I narrowed the problem down.

I have a repeater field on said problematic page. I use the repeater to generate a subnavigation for the page in the front-end. The repeater field has a page field in it (called subnav_page). I have 4 or 5 repeater list items in total. When the page field in at least one repeater item points to the problematic page (in the case of the problematic page the page field of every repeater item must point to the problematic page [which is the one I am editing right now], because the subnavigation should only consist of anchors pointing to specific sections on the page in the front-end) than the ordering does not work, like described. If the page field of every repeater item points to any page except the problematic page, than the ordering works. I double and triple checked this. Also I checked, that the subnav_page page field is only used in the context of the repeater field, nowhere else. There is really no evident connection between the repeater field and the fields inside of the repeater field, and the PageTable field. But apparently, there is.

I have to take a break, this is just too weird …

  • Like 1

Share this post

Link to post
Share on other sites

Current status: I can reproduce this issue on two fresh installations (latest 2.7.3 and latest 3.0.8). But I made one more discovery that was missing to reproduce the issue: the page field inside of the repeater field must be declared as required, than you can reproduce the issue (this is also the case in the original problematic page described in my first post).

So, again, to reproduce this issue:

  • Create a repeater field, which has a page field inside (page field must be marked as required).
  • Create a pagetable field, allowing any template to be generated within it (like basic-page).
  • Add the two fields to a template (like basic-page).
  • Edit a page with the template basic-page.
  • Add two entries to the pagetable field and save the page.
  • Add a repeater item and select the current page in the page field.
  • Add another repeater item and select not the current page in the page field.
  • Save the page.
  • Try to change the order of the pagetable entries and hit save. 
  • The re-ordering should not work.

To get the ordering working:

  • Change the selected page of the first repeater item from the current page to another page.
  • Save the page.
  • Re-order the pagetable items and hit save.
  • Now the re-ordering should work.

I think I found a bug.

  • Like 2

Share this post

Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By louisstephens
      So I ran into a very strange issue today. I have a template with a pagetable and I went to add an item to it, when I went to select an image (for an image field) the page instantly threw up an error
      "ProcessPageSearchLive: No search specified"
      The page's content also switched to the image attached. This all worked perfectly last week (local mamp box). Has anyone experienced this before, and how did you solve it?

    • By jploch
      Hey folks,
      I have a question regarding rendering of template files that are in a subfolder of the template folder.
      How would I for example render these PageTable items, when their template files are inside templates/blocks/:
      <div class="grid"> <?php foreach($page->grid_ext as $item): ?> <div id="pteg_<?= $item->id ?>"> <?php echo $item->render(); ?> </div> <?php endforeach; ?> </div> I tried this, but get an error:
      <?php echo $item->render(wire('config')->paths->templates . '/blocks/'); ?>  
    • By opalepatrick
      Hi, trying to order pages by modified date, date. I can do 'sort=-date_modified, sort=-date' but that will always put the modified date first regardless of actual date order. I just want to coalesce the two fields and sort. Any ideas would be appreciated.
    • By Noel Boss
      Hi everyone 🙌
      Is there a way to order the language tabs in the backend? Currently, they seem to be ordered based on the created date (or id?) …
      ( time passes … ⏰ 🚶‍♂️)
      Just answered my own question. One can reorder the languages in the page tree under admin » languages or directly in the DB » pages » template_id=54 » sord field.
      Anyone knows if there are side effects when moving the default language from sort 0 to somewhere higher?
    • By Peter Knight
      <?php $Cats=$pages->find("parent=1086, id!=$page, sort=sort"); foreach($Cats as $Cat) { echo " I have a selector that pulls in 4 child pages of a parent and the order is set to reflect the order of the tree.
      My client has asked that instead of
      Cat 1 | Cat 2 | Cat 3 | Cat 4
      we instead display
      Cat 4 | Cat 1 | Cat 2 | Cat 3 
      However, I can't change the sort order in the tree.
      Can anyone guide me on the correct approach here?
  • Create New...