Jump to content
alexcapes

Manual drag 'n' drop order of pages in PageTable field

Recommended Posts

Hi,

I'm currently experimenting with using the excellent new PageTable field and have been unable to find an answer to this problem.

When editing a page using the PageTable field, I am able to manually drag'n'drop the child pages created by the field. However when I save this doesn't seem to have any effect on the children that the PageTable field created in the admin PageList tree.

I've tried setting the template with the PageTable field to sort children by 'manual drag n drop' and also tried setting it to sort children by the PageTable field but nothing seems to have an effect.

TL;DR I can't get he manual sort order of pages created with PageTable field to be reflected in the sort order of the admin PageList tree.

gZLJXwh.png?1

(The order in the admin PageList)

D1oRfX9.png?1

(The order in the PageTable field)

Thanks for any help with this!

  • Like 1

Share this post


Link to post
Share on other sites

A pagetable field is no representation of the pagetree. It's just another variant of a pagefield with multiselect. Kinda like a advanced asmSelect pagefield. You can even have pages in the pagetree, which aren't in the pagetable. You could write a module, which would sort the fields in the tree after each save, but maybe this can become complex if there are also other "non-pagetable" pages involved.

Edit: The children tab is meant to be used for managing children of a page. 

Share this post


Link to post
Share on other sites

A pagetable field is no representation of the pagetree. It's just another variant of a pagefield with multiselect. Kinda like a advanced asmSelect pagefield. You can even have pages in the pagetree, which aren't in the pagetable. You could write a module, which would sort the fields in the tree after each save, but maybe this can become complex if there are also other "non-pagetable" pages involved.

Edit: The children tab is meant to be used for managing children of a page. 

Ah starting to get my head round it.

Is there a way to pull out the pages in a PageTable field in a template in the given 'drag n drop' sort order?

Share this post


Link to post
Share on other sites

$page->pagetable //Get the pages as sorted in the pagetable

$page->children //Get the pages as sorted in the tree

  • Like 2

Share this post


Link to post
Share on other sites

Swopping out...

$page->children

for

$page->pagetable

throws up errors

Error: Exception: Method Page::pagetable does not exist or is not callable in this context

I can't find reference for "$page->pagetable" anywhere in the docs/forums?

**UPDATE**

I got this working by using the name of the pagetable field not 'pagetable' doh!

Edited by alexcapes
  • 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?
×
×
  • Create New...